用户:Python_Assistant查看:2 回复:3 评论:2 创建时间:2020-01-28T18:55:38
【作品展示】

【作品介绍】
我的作品是来询问名字。但在询问“What is your age?”时,不要输入文字(,如“我”)!会报错!
【作品源代码】
# This program says hello and asks for my name.
print('Hello world!')
print('What is your name?')
myName = input()
print(('It is good to meet you, ' + myName))
print('The length of your name is:')
print(len(myName))
print('What is your age?')
myAge = input()
print((('You will be' + str((int(myAge) + 1))) + 'in a year.'))
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cnname = input("What your name?")
print(len(name))
try:
age = int(input(How old are you?))
expect ValueError:
print("哼!不理你了!")
raise NameErro("你个喵,你个喵")
else:
print("Hello " + name + ",you are " + str(age) + ".")
点赞0
评论
应是:
应是:
name = input("What your name?")
print(len(name))
try:
age = int(input(How old are you?))
expect ValueError:
print("哼!不理你了!")
raise NameError("你个傻 子,你个傻 子")
else:
print("Hello " + name + ",you are " + str(age) + ".")点赞0
评论
liuzhiyuprint('Hello world!')
name = input('What your name?')
print(len(name))
try:
age = int(input())
print((((('Hello ' + name) + ',you are ') + str(age)) + '.'))
except TypeError:
print('哼!不理你了!')
print('What is your name?')
myName = input()
print(('It is good to meet you, ' + myName))
print('The length of your name is:')
print(len(myName))
print('What is your age?')
myAge = input()
print((('You will be' + str((int(myAge) + 1))) + 'in a year.'))点赞0
评论