Open
Conversation
📃Assignment 1📃 📄Task1 This Python program allows the user to perform basic arithmetic calculations on two numbers: The user is prompted to enter two numbers: a and b. It then calculates and displays: Addition of a and b Subtraction of b from a Multiplication of a and b Division of a by b The program uses Python’s built-in arithmetic operators (+, -, *, /) and the input() function to take user input, converting the input to integers using int(). 📃Assignment 1📃 📄Task2 This Python program is designed to interactively collect and display a user’s full name with a custom greeting. 🔹 Functionality: The program first prompts the user to enter their first name using input(). Then it asks for the middle name. If the user doesn't enter anything and simply presses Enter: The program prints: ["No middle name entered."] Otherwise, it prints the middle name entered by the user. Next, the program prompts the user to enter their last name. Finally, it displays a friendly greeting that includes the full name: If a middle name was entered, it shows: ["Hello <first> <middle> <last>! Welcome to the Python program."] If the middle name is left blank, the greeting still works properly. 🔹 Concepts Used: ->[input()] for user interaction ->[if-else] conditional statements ->String concatenation and printing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📃Assignment 1📃
📄Task1
This Python program allows the user to perform basic arithmetic calculations on two numbers:
The user is prompted to enter two numbers: a and b.
It then calculates and displays:
Addition of a and b
Subtraction of b from a
Multiplication of a and b
Division of a by b
The program uses Python’s built-in arithmetic operators (+, -, *, /) and the input() function to take user input, converting the input to integers using int().
📃Assignment 1📃
📄Task2
This Python program is designed to interactively collect and display a user’s full name with a custom greeting.
🔹 Functionality:
The program first prompts the user to enter their first name using input().
Then it asks for the middle name. If the user doesn't enter anything and simply presses Enter:
The program prints: ["No middle name entered."]
Otherwise, it prints the middle name entered by the user.
Next, the program prompts the user to enter their last name.
Finally, it displays a friendly greeting that includes the full name:
If a middle name was entered, it shows:
["Hello ! Welcome to the Python program."]
If the middle name is left blank, the greeting still works properly.
🔹 Concepts Used:
->[input()] for user interaction
->[if-else] conditional statements
->String concatenation and printing