我正在尝试创建一个简单的程序,我要求用户放置name,age然后使用if else打印结果.
我希望什么时候放到20岁,所以结果应该来
祝贺你的年龄是20,你可以找到真相
但这里不起作用的是我正在使用的代码.
码
name = input("what is your name \n")
print('Nice to meet you', name, "!!")
age = input("Your Age ? \n")
if age > 18:
print('Congratulation ' + name + ' your age is '+ str(age), ' and you can find the truth ')
else:
print('Sorry ' + name + 'your age is '+ str(age), ' and you can also find the truth if you start from today')
Run Code Online (Sandbox Code Playgroud)
运行我的代码后我得到的错误.
错误
what is …Run Code Online (Sandbox Code Playgroud) python ×1