Unit 1HomeWork
Unit 1HomeWork
a. If you are trying to print your name, what happens if you leave out one of
the quotation marks or both, and why?
If I try to call python print built-in function without quotation marks, it will
certainly raise an error because Python follows strict syntax rules to translate the
codes into machine instructions. When the syntax is incorrect, Python interpreter
cannot parse it properly and will raise an error.
On the other hand, “**” is used for exponentiation. Check the following picture.
When you use “”, it works as (2x3). Moreover, “**” works as (2x2x2).
d. Run the commands type('67') and type(67). What is the difference in the
output and why? In Python, type built-in function is used to check the type of a
variable or value. In the first picture, when we insert 67 into quotation marks,
Python treats it as string. Everything in the quotation will be string type. On the
other hand, without quotation marks, Python will treat it as integer type.
Part II:
a. To multiply your age by 2 and display it. For example, if your age is 16,
so 16 * 2
= 32.
Ans:
c. To display the examination schedule (i.e., the starting and the ending
day) of this term.
Ans: