-
Notifications
You must be signed in to change notification settings - Fork 0
/
python.py
56 lines (49 loc) · 1.47 KB
/
python.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#sum
def sum():
inclement = 1
ni = int(input("put a number to add: "))
if ni <= 0:
print(f"{ni}: number must be greater than zero !")
elif ni > 0:
n2 = int(input("put a number to finish: "))
while inclement <= n2:
print(f"{ni} + {inclement} = {ni + inclement} ")
inclement += 1
print(sum())
#less
def less():
ni = int(input("put a number to decrease: "))
inclement = ni + 1
if ni <= 0:
print(f"{ni}: number must be greater than zero !")
elif ni > 0:
n2 = int(input("put a number to finish: "))
while inclement <= n2:
print(f"{inclement} - {ni} = {inclement - ni}")
inclement += 1
print(less())
#multiplication
def multiplication():
inclement = 1
ni = int(input("put a number to multiply: "))
if ni <= 0:
print(f"{ni}: number must be greater than zero !")
elif ni > 0:
n2 = int(input("put a number to finish: "))
while inclement <= n2:
print(f"{ni} x {inclement} = {ni * inclement} ")
inclement += 1
print(multiplication())
#division
def division():
ni = int(input("put a number to divide: "))
inclement = ni
if ni <= 0:
print(f"{ni}: number must be greater than zero !")
elif ni > 0:
n2 = int(input("put a number to finish: "))
while inclement <= n2:
print(f"{inclement} / {ni} = {inclement // ni}")
inclement += ni
print(division())
# code final