Assignment 3 - Functions (1) - 1
Assignment 3 - Functions (1) - 1
Scenario:
Write a Python program which have four functions: multiplication, addition, subtraction and division.
Do the following:
Instructions Points
1 Ask the user to enter two values and convert the values into float 2
2 Ask the user to enter option 1 for multiplication, 2 for addition, 3 for 1
subtraction and 4 for division
3 Use if statement to check which option the user has selected and call the 2
appropriate function according to the user’s input.
4 Function should calculate the result and return one value 2
5 Display the result 1
Total 8
Expected output:
If the user enters values 3 and 2:
Enter the first number: 3
Enter the second number: 2
Enter 1 for multiplication, 2 for addition, 3 for subtraction and 4 for division: 4
The result is 1.5
Requirements:
1. Download the assignment document.
2. Copy and paste the Python code into the assignment document.
3. Provide a screenshot for the console screen in the assignment document.
4. Submit the assignment document.
Page 1 of 3
العربية المملكة
The kingdom of Saudi Arabia
السعوديةEducation
Ministry of
King Abdulaziz
التعليم وزارةUniversity
عبدالعزيز The Applied
الملك College
جامعة
Computer and Information Technology
الكلية التطبيقية
قسم الحاسب اآللي وتقنية
Python Code :
Page 2 of 3
العربية المملكة
The kingdom of Saudi Arabia
السعوديةEducation
Ministry of
King Abdulaziz
التعليم وزارةUniversity
عبدالعزيز The Applied
الملك College
جامعة
Computer and Information Technology
الكلية التطبيقية
قسم الحاسب اآللي وتقنية
Page 3 of 3