
okay I'm VERY new to python and i'm still in the dark but I have been able to make some basic programs, i stumbled across this code and i was wondering how to use uppercase and lowercase characters to make a decision in a program.....
CODE
# Area calculation program
print “Welcome to the Area calculation program”
print “–––––––––––––”
print
# Print out the menu:
print “Please select a shape:”
print “1. Rectangle”
print “2. Circle”
# Get the user’s choice:
shape = input(“> “)
# Calculate the area:
if shape == 1
height = input(“Please enter the height: “)
width = input(“Please enter the width: “)
area = height*width
print “The area is”, area
else:
radius = input(“Please enter the radius: “)
area = 3.14*(radius**2)
print “The area is”, area
okay i tried doing this
CODE
# Area calculation program
print “Welcome to the Area calculation program”
print “–––––––––––––”
print
# Print out the menu:
print “Please select a shape:”
print “<a> Rectangle”
print “<b> Circle”
# Get the user’s choice:
shape = input(“> “)
# Calculate the area:
if shape == a || shape == A #<========= here's my problem
height = input(“Please enter the height: “)
width = input(“Please enter the width: “)
area = height*width
print “The area is”, area
else:
radius = input(“Please enter the radius: “)
area = 3.14*(radius**2)
print “The area is”, area
and obviously ran to an error i was guessing......
This post has been edited by james_L: 4 Oct, 2008 - 01:31 AM