From bdf586ccb78e6d3abfe8532f0ee7839280a70560 Mon Sep 17 00:00:00 2001 From: DuskForged-Coder Date: Sun, 27 Jul 2025 21:47:56 +0530 Subject: [PATCH] Add files via upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 📃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 --- Assgnment 1 Task 2.py | 10 ++++++++++ Assgnment 1 task1 .py | 6 ++++++ 2 files changed, 16 insertions(+) create mode 100644 Assgnment 1 Task 2.py create mode 100644 Assgnment 1 task1 .py diff --git a/Assgnment 1 Task 2.py b/Assgnment 1 Task 2.py new file mode 100644 index 0000000..c4427c4 --- /dev/null +++ b/Assgnment 1 Task 2.py @@ -0,0 +1,10 @@ +firstname = input("Enter your first name: ") +middlename = input("Enter your middle name (or press Space & then press Eenter if none): ") + +if middlename == 0: + print("No middle name entered.") +else: + lastname = input("Enter your last name: ") + +# Full greeting with all three names +print("Hello", firstname,middlename,lastname + "! Welcome to the Python program.") diff --git a/Assgnment 1 task1 .py b/Assgnment 1 task1 .py new file mode 100644 index 0000000..29f7ef7 --- /dev/null +++ b/Assgnment 1 task1 .py @@ -0,0 +1,6 @@ +a=int(input('Choose your first no.:- ')) +b=int(input('Choose your second no.:- ')) +print("Addition",a+b) +print("Substraction",a-b) +print("Multiplication",a*b) +print("Division",a/b) \ No newline at end of file