# Area of a Rectangle print "which variable are you given?" print "length, width, or Area?" Var1 = raw_input("VAr1= ") Var2 = raw_input("Var2= ") if Var1 = "length" and Var2 = "width"; length = raw_input("length= ") width = raw_input("width= ") print length*width if (Var1 = "length" and Var2 = "width") or (Var1 = "width" and Var2 = "length") elif Var1 = "Area" and Var2 = "width"; area = raw_input("Area= ") width = raw_input("width= ") print area/width elif Var1 = "Area" and Var2 = "length"; area = raw_input("Area= ") length = raw_input("length= ") print area/length
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question