Type the statements below into your Python interpreter. For each statement, copy the output into your Discussion Assignment and explain the output. Compare it with any similar examples in the textbook, and describe what it means about your version of Python.
>>> print 'Hello, World!'
>>> 1/2
>>> type(1/2)
>>> print(01)
>>> 1/(2/3)
1.
print 'Hello, World!'
Output
Error
Explanation
Missing parentheses in call to 'print'
2.
>>> 1/2
Output
0.5
<class 'float'>
Explanation
1 divided by 2 is equal to 0.5.
3.
>>> type(1/2)
Output
<class 'float'>
Explanation
1 divided by 2 is equal to 0.5 which is a float.
4.
>>> print(01)
Output
Error
Explanation
leading zeros in decimal integer literals are not permitted
5.
>>> 1/(2/3)
Output
1.5
Explanation
The expression given is equivalent to 1.5
Comments
Leave a comment