我正在尝试编写一个简单的程序,python 计算你名字中的字符数并决定你的名字有多酷。试图学习 if 和 elif 语句......这就是我到目前为止所拥有的
PS我正在使用python 2.7
def main():
print"This program will tell who has a cooler name on a scale of 1-10"
print""
name=input("Enter your name: ")
if len(name)<=4:
print"on a scale of 1-10 your name is a 2! what a lame name..."
elif (len(name)>4) and (len(name)<=7):
print"That is a cool name you deserve a 8/10! Awesome!"
elif len(name)>7:
print"you are a 10/10, no one has a better name than you!"
main()