Learn practical skills, build real-world projects, and advance your career
Created 2 years ago
Week 1 Practice Questions with solutions
MCQ's
Question_1:
Data Types in Python:
What will be the output of the following code snippet?
number='159'
print(type(number))
- Error
- <class 'str'>
- <class ‘string’>
- <class ‘int’>
number = '159'
print(type(number))
# Expalanation: The numbers are treated as string data type because they are written inside quotes.
<class 'str'>
Question_2:
Data Types in Python:
What will be the output of the following code snippet?
number=34.721
print(float(int(number)))
- 34
- 34.721
- 34.0
- Compilation Error