简体   繁体   English

python语法错误无效语法

[英]python syntax error invalid syntax

I'm new to Python programing language.我是 Python 编程语言的新手。 I purchased a book and I've been reading it.我买了一本书,一直在看。 The book is called (3x) Python Programming for the absolute beginner Third Edition.这本书被称为 (3x) Python Programming 面向绝对初学者的第三版。 I'm trying to put what I've so far learned into action.我正在努力将我迄今为止学到的东西付诸行动。 I have a problem that I don't understand I know it's simple but I'm not sure how to solve it so if somebody can tell me what my the problem is and how to correct it.我有一个我不明白的问题我知道这很简单但我不确定如何解决它所以如果有人可以告诉我我的问题是什么以及如何纠正它。 I appreciate it in advance!我提前感谢! :) To add more I also tried doing it with python 2x and I had the same message error syntax, Invalid syntax. :) 要添加更多内容,我还尝试使用 python 2x 进行操作,但我有相同的消息错误语法,即无效语法。

Python练习

Whitespace is used to denote level of indention in Python.空格用于表示 Python 中的缩进级别。

The else: needs to be aligned (have the same indentation level) as the if jim_age ... . else:需要与if jim_age ...对齐(具有相同的缩进级别)。

if jim_age > sam_age:
    print("jim is older")
else:
    print("sam is older")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM