In: Computer Science
Python: I want to make the following code to prompt the user if want to run the software again. I am new to python, so i do not know if it works like c++. If can explain that would be much appreciated
base = float(input("Enter base of the triagle: "))
Triangle_Right = float(input("Enter right side of the triagle: "))
Triangle_Left = float(input("Enter left side of the triagle: "))
height = float(input("Enter the height of the triangle: "))
perimiter = base + Triangle_Right + Triangle_Left
area = (base*height)/2
print("The perimiter is =", perimiter)
print("The area is =", area)
# read a base value for triangle and store it in variable base as a float(same as c++ float) base = float(input("Enter base of the triangle: ")) # read a right side value for triangle and store it in variable Triangle_Right as a float(same as c++ float) Triangle_Right = float(input("Enter right side of the triangle: ")) # read a left side value for triangle and store it in variable Triangle_Left as a float(same as c++ float) Triangle_Left = float(input("Enter left side of the triangle: ")) # read a height value for triangle and store it in variable height as a float(same as c++ float) height = float(input("Enter the height of the triangle: ")) # calculate perimeter perimeter = base + Triangle_Right + Triangle_Left # calculate are area = (base * height) / 2 # print perimeter print("The perimeter is =", perimeter) # print area print("The area is =", area) """ This is mostly like C++ don't need to use ; after each statement print is used like cout and input is used instead of cin all other statements are mostly same """