Skip to content

Commit 923d000

Browse files
committed
New
1 parent 2d39788 commit 923d000

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

ex059.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#Create a program that reads two values and displays a menu on the screen:
2+
#[ 1 ] add
3+
#[ 2 ] multiply
4+
#[ 3 ] bigger
5+
#[ 4 ] new numbers
6+
#[ 5 ] exit the program
7+
#Your program must perform the requested operation in each case.
8+
9+
first_value = int(input('Enter a number:'))
10+
second_value = int(input('Enter other number:'))
11+
option = 0
12+
13+
while option != 5:
14+
print('''Choose an option...
15+
[1] Add
16+
[2] Multiply
17+
[3] Bigger
18+
[4] New numbers
19+
[5] Exit the program ''')
20+
choice = int(input('Enter your choice:'))
21+
if choice == 1:
22+
add = first_value + second_value
23+
print(f'The sum of {first_value} + {second_value} is {add}')
24+
elif choice == 2:
25+
multiply = first_value * second_value
26+
print(f'The product of {first_value} and {second_value} is {multiply}')
27+
elif choice == 3:
28+
if first_value > second_value:
29+
bigger = first_value
30+
else:
31+
bigger = second_value
32+
print(f'Between {first_value} and {second_value} the largest value is {bigger}.')
33+
elif choice == 4:
34+
print('Enter the numbers again:')
35+
first_value = int(input('Enter a number:'))
36+
second_value = int(input('Enter other number:'))
37+
elif choice == 5:
38+
print('Finishing...')
39+
else:
40+
print('Invalid option. Try again.')
41+
print('End of program.')

0 commit comments

Comments
 (0)