You are on page 1of 1

I am using Python 3 on VS code,

When I type the statement:


>>> print 'Hello, World!'
the output shows: SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
Python is a formal language that needs to be write exactly with syntax rules which are from
phyton, so when I write with parentheses and quotations:
>>> print (“Hello, World!”)
the output shows: Hello World!

When I type the statement:


>>> 1/2
the output shows: 0.5
because python have arithmetic operators the signal ‘/’ perform division and the result is a
floating-point number.

When I type the statement:


>>> type(1/2)
the output shows: <class 'float'>
because the result is a floating-point number belonging to the class float.

When I type the statement:


>>> print(01)
the output shows: SyntaxError: leading zeros in decimal integer literals are not permitted; use an
0o prefix for octal integers.
Python 3 have strict syntax rules that govern the structure of statements, the number 1 belongs
to a class of integers, but if I want to print ’01’, I can transform ‘01’ in a string class writing in
the interpreter >>> print(“01”).

When I type the statement:


>>> 1/(2/3)
the output shows: 1.5
Python 3 acts like a calculator when you write integers and arithmetic operators (+, - , / , * ). So,
the result of 1 divided to 2/3 is 1.5 for each and it belongs to a class float.

Reference:

Downey, A. (2015). Think Python: How to think like a computer scientist. Green Tea Press.
This book is licensed under Creative Commons Attribution-NonCommercial 3.0 Unported (CC
BY-NC 3.0). 

You might also like