-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsquare.py
More file actions
34 lines (26 loc) · 841 Bytes
/
square.py
File metadata and controls
34 lines (26 loc) · 841 Bytes
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
def arp(x,y):
ar = x*y
per = 2*(x+y)
return ar,per
q = input("Square or rectangle?")
if q == "rectangle":
x = input("Enter a number:")
while x.isdigit() == False:
print("Do not enter other characters than numbers.")
x = input("Enter a number only please:")
x = int(x)
y = ("Enter another number:")
while y.isdigit() == False :
print("Do not enter other characters than numbers.")
y = input("Enter a number only please:")
y = int(y)
print(arp(x,y))
if q == "square":
l = input("Enter a number:")
while x.isdigit() == False:
print("Do not enter other characters than numbers.")
l = input("Enter a number only please:")
l = int(l)
def sq():
arp(l,l)
print(sq())