请看代码。我正在使用机器人汽车画一个字母,在这段代码中,当我输入 b 时,它仍然会画出小写字母 a。
import create
# Draw a:
def drawa():
#create robot
robot = create.Create(4)
#switch robot to full mode
robot.toFullMode()
for i in range(1280):
robot.go(20,30)
robot.stop()
robot.move(-40,20)
# Draw b:
def drawb():
#create robot
robot = create.Create(4)
#switch robot to full mode
robot.toFullMode()
robot.move(-100,20)
for i in range(1270):
robot.go(20,-30)
robot.stop()
# Draw c:
def drawc():
#create robot
robot = create.Create(4)
#switch robot to full mode
robot.toFullMode()
for i in range(700):
robot.go(20,30)
robot.stop()
# Define Main Function
def main():
# While loop
while(True):
# Prompt user to enter a letter
letter = raw_input("Please enter the letter you want to draw: ")
# If user enters the letter a, draw a
if letter=="A" or "a":
drawa()
# If user enters the letter b, draw b
elif letter=="B" or "b":
drawb();
# If user enters the letter c, draw c
elif letter=="C" or "c":
drawc();
# If user enters anything other than a letter from a-z,
# ask them to enter a valid input
else:
print("Please enter a letter from a-z.")
main()
请帮忙。