英文:
Syntax error for no apparent reason in python
问题
I have no idea why I have a syntax error in python at all. Here is my code. I am a beginner. This is Python 3.8.1 shell:
name = str(input("What is your name?"))
age = int(input("How old are you?")) # <-- error here
siblings = int(input("How many siblings do you have?"))
print("Your name is", name)
print("You are", age., "years old")
print("And you have", siblings, "siblings")
This is very weird. I don't understand why it is happening. Look at the letter "a" in age.
英文:
I have no idea why i have a syntax error in python at all here is my code I am a beginner this is python 3.8.1 shell:
name = str(input("What is your name?"))
age = int(input("How old are you?")) # <-- error here
siblings = int(input("How many siblings do you have?"))
print("Your name is", name)
print("You are", age., "years old")
print("And you have", siblings, "siblings")
This very weird. I don't understand why it is happening look at the letter a in age.
答案1
得分: 1
这只是 age
而不是 age.
name = str(input("你叫什么名字?"))
age = int(input("你多大了?")) # 在这一行找不到错误
siblings = int(input("你有多少兄弟姐妹?"))
print("你的名字是", name)
print("你今年", age, "岁了") # 我修改了这一行
print("你有", siblings, "个兄弟姐妹")
英文:
It is just age
not age.
name = str(input("What is your name?"))
age = int(input("How old are you?")) # didn't find the error on this line
siblings = int(input("How many siblings do you have?"))
print("Your name is", name)
print("You are", age, "years old") # I changed this line
print("And you have", siblings, "siblings")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论