执行demo中的
length=5
breadth=2
area=length*breadth
print 'Area is',area
print 'Perimeter is',2*(length+breadth)
File "expression.py", line 7
print 'Area is', area
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('Area is', area)?
查询发现是demo代码python版本是2
本地python是3
print 是print('Area is', area)才对、
改为:
print ('Area is', area)
print 'Perimeter is',2*(length+breadth)
后,执行成功