# Untitled

unknown
plain_text
2 years ago
2.6 kB
2
Indexable
Never
```""""
sampo perunka comp sci 1
"""

"""virheentarkastus ettei kukaan laita vääriä arvoja"""
while True:
asd = input(question)
try:
asd = float(asd)
if asd > 0:
return asd
else:
pass

except ValueError:
pass

def square1(value):
"""suuret määrät spagettii aaaaaaaaaaaaaaa"""
halkaisija = value * 4
return halkaisija
def square2(value):
"""vähän lisää spagettia lisää aaaaaaaaaaaaaa"""
surface_area = value * value
return surface_area

def rectangle1(side1, side2):
halkaisija = side1 * 2 + side2 * 2
return halkaisija

def rectangle2(side1, side2):
"""Calculates the surface area for square"""
surface_area = side1 * side2
return surface_area

PI = 3.14159265359
halkaisija = 2 * PI * radius
return halkaisija
"""Calculates the surface area for circle"""
PI = 3.14159265359
surface_area = PI * (radius ** 2)
return surface_area
"""
Print a menu for user to select which geometric pattern to use in calculations.
"""
while True:
answer = input("Enter the pattern's first letter or (q)uit: ")

squares_side = read_input("Enter the length of the square's side: ")
print(f"The circumference is {(square1(squares_side)):.2f}")
print(f"The surface area is {(square2(squares_side)):.2f}")
pass

rectangle_side1 = read_input("Enter the length of the rectangle's side 1: ")
rectangle_side2 = read_input("Enter the length of the rectangle's side 2: ")
print(f"The circumference is {(rectangle1(rectangle_side1,rectangle_side2)):.2f}")
print(f"The surface area is {(rectangle2(rectangle_side1,rectangle_side2)):.2f}")
pass

pass

return

else:
print("Incorrect entry, try again!")

# Empty row for the sake of readability.
print()

def main():