PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Created by Houache Yacine
print ("""*.English:
*.Welcome to the calculator:
*.Follow the instructions to avoid making mistakes
*.Instructions:
1.Press RUN"
2.Select the operation you want to perform (addition, subtraction, multiplication, division):
_ If you want to add, write (addition or add)
_ If you want to subtract, write (subtraction or subtract)
_ If you want to multiply, write (multiplication or multiply)
_ If you want to divide, write (division or divide)
3.Then leave a line
4.Write the first number, then leave a line and write the second number to perform the operation
_ In division, you cannot divide by 0
5.Press SUBMIT to display the result
*.Operation:\n""")
operation = input().strip().lower()
# check if input can be converted to float
def to_float(n):
try:
return float(n)
except ValueError:
print(f"{n} cannot be converted to a float")
# exit the program if a number is missing
exit()
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run