0

Can you help me fix my code

#Import Library import sys def main(): #Define main() function # Declare variables radius = 4 diameter = 2 height = 2 volume = 2 #Get input # If inputting radius or diameter decision = input("Enter \"r\" for radius or \"d\" for diameter: ") # Get raidus or diameter if decision == "r": # Get radius radius = int(input("Enter the radius: ")) elif decision == "d": # Get Diameter diameter = int(input("Enter the diameter: ")) raidus = (diameter / 2) else: print ("You entered an invalid answer. ") sys.exit(0) #Get the number right height = int(input("Enter the height: ")) #Processing #Caculate the Volume volume = (3.14 * raidus * raidus * height) #Output # Print the Volume print("The volume of the cylinder is", volume, "cubic units") main() #call the main() function

3rd Dec 2020, 8:11 PM
Akon C
Akon C - avatar
2 Answers
+ 1
There were some misspellings and missing indentation https://code.sololearn.com/c9W8BtpFwqTz/?ref=app
3rd Dec 2020, 8:45 PM
Slick
Slick - avatar
0
I see strange indentations everywhere, in particular: In the elif Everything after the if-else loop
3rd Dec 2020, 8:43 PM
Angelo
Angelo - avatar