Q1. Write the output of the following :
>>> x = 8
>>> x = 5
>>> print (x + x)
Q2. Is the following statement correct?
>>> a, b, c = 2 , 3 , 'Amit'
Q3. Identify the invalid variable names from the following and specify the reason also.
- m_n
- unit_day
- 24Apple
- #sum
- for
- s name
Q5. Keywords can be used as variable names (T/F)
Q6. Write the code to display all the keywords available in python.
Q7. What do you mean by expression?
Q8. Write the python expressions equivalent to the following algebraic/arithmetic expressions
- z = u/5
- z = 9ab + d
- z = x+4/j + 7
SOLUTIONS
Q1. Write the output of the following :
>>> x = 8
>>> x = 5
>>> print (x + x)
Ans. 10
Q2. Is the following statement correct?
>>> a, b, c = 2 , 3 , 'Amit'
Ans. yes
Q3. Identify the invalid variable names from the following and specify the reason also.
- m_n
- unit_day
- 24Apple
- #sum
- for
- s name
Q4. What are keywords?
Q5. Keywords can be used as variable names (T/F)
Ans. False
Q6. Write the code to display all the keywords available in python.
Ans.
import keyword
print(keyword.kwlist)
Q7. What do you mean by expression?
Ans. A combination of operators and operands is called expression.
like - a + b * c
Q8. Write the python expressions equivalent to the following algebraic/arithmetic expressions
- z = u/5
- z = 9ab + d
- z = x+4/j + 7
Q9. What are operators? Name three types of operators.
Q10. >>> 7 % 10 will return ____________________
Ans 7
No comments:
Post a Comment