关于学习python的练习语句
我尝试做一些Python命令。启动解释器然后等待主提示命令>>>出现。(不用等太久)
这个解释器就像是一个简单的计算器:可以向其录入一些表达式,它会给出返回值。表达式语法很直白:运算符+,-,*,/,与其他语言一样(比如:Pascal&C);括号用于分组。例如:
print
>>>2+2
4
>>># This is a comment
...2+2
4
>>>2+2# and a comment on the same line
4
>>>(50-5*6)/4
5
>>> #Integer division returns the floor.
... 7/3
2
>>>7/-3
3
等号('=')用于给变量赋值:
>>>width = 20
>>>height = 5*9
>>>width*height
900