Florent Madelaine
84d386a4ae
renommé : exo1.py -> 1/exo1.py renommé : exo2.py -> 1/exo2.py renommé : exo3.py -> 1/exo3.py renommé : exo3b.py -> 1/exo3b.py renommé : first.py -> 1/first.py renommé : loop.py -> 1/loop.py renommé : math0.py -> 1/math0.py renommé : string0.py -> 1/string0.py nouveau fichier : 2Prog.md
31 lines
788 B
Python
31 lines
788 B
Python
# Display the following message:
|
|
#**************
|
|
# 1) Square
|
|
# 2) Triangle
|
|
|
|
# Enter a number :
|
|
#**************
|
|
|
|
|
|
# If the user enters 1, then it should ask them for the length of one of its sides and display the area. If they select 2, it should ask for the base and height of the triangle and display the area. If they type in anything else, it should give them a suitable error message.
|
|
|
|
# square area == side*side
|
|
# triangle area == (base*height)/2
|
|
|
|
|
|
print("***************")
|
|
print("1) Square")
|
|
print("2) Triangle")
|
|
print("***************")
|
|
v = int(input("Enter a number : "))
|
|
|
|
if v==1:
|
|
square = int(input("coté : "))
|
|
area = square*square
|
|
elif v==2:
|
|
height = int(input("hauteur : "))
|
|
base = int(input("base : "))
|
|
area = (height*base)/2
|
|
|
|
print("L'aire est", area)
|