Computer Science, asked by klintonverma1, 6 months ago

Write a program to calculate area of square in python?

Answers

Answered by Equestriadash
8

choice = "Yes"

while choice == "Yes":

   s = float(input("Enter the length of a side of the square: "))

   area = s**2

   print(area, "is the area of the square.")

   print()

   choice = input("Would you like to go again? [Yes/No]: ")

   print()

print("Thank you!")

I've used a while loop in this case, if the user would like to go again.

A while loop is an iteration control statement, that does repeated checking for every situation. It mostly depends upon Boolean values and proceeds accordingly.

Answered by sunprince0000
1

choice = "Yes"

while choice == "Yes":

  s = float(input("Enter the length of a side of the square: "))

  area = s2

  print(area, "is the area of the square.")

  print()

  choice = input("Would you like to go again? [Yes/No]: ")

  print()

print("Thank you!")

I've used a while loo

A while loop is an iteration control statement, that does repeated checking for every situation. It mostly depends upon Boolean values and proceeds accordingly.

Similar questions