Starting from:

$30

CSCI161L Assignment 5 -Solved

Create a function called menu (), by passing two arguments var1 and var2, which contains user input 
integer values. The objective of the menu () is to display the menu, and call other user defined 
functions minimum (), discount (), Pythagorean () and exit (). 
1. Prompt the user to enter two positive integer numbers and store it in variables var_1 and var_2. 
2. Define a function menu () to display the following options: 
1 – Minimum 
2 –Calculate discount 
3 – Pythagorean theorem 
4 – Exit 
For each user input one of the following functions will be executed. 
Option 1: The function minimum () is used to find the minimum among the two input numbers 
var1 and var2 (which should be passed through the function call). 
Option 2: Define the function discount (). This function is used for calculating the discount of a 
number. It should accept an integer number and a percentage rate (integer) and calculates the 
discount using the formula, Discount = Number * rate/100. 
Option 3: Define the function Pythagorean (). This function should get 3 dimensions, width, 
height, and hypotenuse from users, and check whether the 3 integer arguments passed along with 
it, follows the Pythagorean theorem (hypotenuse2 = width2 + height2 ). The function should return 
a boolean (True or False). 
Option 4: Define function exit_func (), to exit from the menu. The function should exit from the 
menu, for the user input 4. 
(Note: The two integer variables var1, var2 and width, height and hypotenuse parameters can be 
declared outside the menu function and is passed as arguments through the function.)Sample Output: 
Instructions:• Preferred programming environment: 
o OS 
: Linux (Mint) 
o Interpreter 
: Python 3 (not Python 2) 
o Editor 
: gedit or editor of your choice 
• The program is saved as a file with .py extension. 
• The program should include a comment block at the top with your name, course number and 
course section, assignment number 
For example: 

More products