Python L4-: Data Types-"int, float, complex, str, list, tuple, dict... Python Data Types Simplified!"
Your Queries:
python
python programming
Introduction to Python
python basics
Python for beginners
#LearnnCoach
#Coach
✅ Python Data Types – Practice MCQs
🧮 1. What is the data type of 5 in Python?
A) float
B) int
C) str
D) complex
✅ Answer: B) int
🔢 2. What is the output type of type(3.14)?
A) int
B) float
C) str
D) tuple
✅ Answer: B) float
🧪 3. What will type(1 + 2j) return?
A) float
B) int
C) complex
D) list
✅ Answer: C) complex
📜 4. Which of the following is a valid string in Python?
A) 'Hello'
B) "123"
C) '''Python'''
D) All of the above
✅ Answer: D) All of the above
🧾 5. What is the output of type([1, 2, 3])?
A) list
B) tuple
C) dict
D) set
✅ Answer: A) list
🔗 6. Which of the following is an immutable data type?
A) list
B) tuple
C) set
D) dict
✅ Answer: B) tuple
❓ 7. What is the result of this code: x = None; type(x)?
A) NoneType
B) str
C) bool
D) null
✅ Answer: A) NoneType
🎯 8. Which of the following will give a tuple output?
A) [1, 2, 3]
B) {1, 2, 3}
C) (1, 2, 3)
D) {'a': 1}
✅ Answer: C) (1, 2, 3)
📐 9. Which function is used to check the data type of a variable?
A) typeof()
B) dataType()
C) type()
D) checkType()
✅ Answer: C) type()
🔍 10. What is the output of type('5')?
A) int
B) float
C) str
D) bool
✅ Answer: C) str
✅ Python Data Type Practice Questions (for VS Code)
🔢 1. Working with int and float
Q1: Calculate and print the sum, difference, and product of two numbers
a = 10
b = 3.5
Write code to:
1. Print the sum of a and b
2. Print the difference of a and b
3. Print the product of a and b
🧮 2. Identify and print the data types
Q2: What will the following code output?
x = 100
y = 3.14
z = 1 + 2j
Print the type of each variable
⚡ 3. Working with complex numbers
Q3: Perform arithmetic on complex numbers
c1 = 2 + 3j
c2 = 1 + 4j
1. Add c1 and c2
2. Subtract c2 from c1
3. Print the result
📜 4. Working with str
Q4: Create a string and perform the following:
name = "Manoj"
1. Print the first and last character
2. Print the length of the string
3. Convert the string to uppercase
4. Check if the string contains the letter 'e'
📋 5. Working with list
Q5: Create a list of your 5 favorite numbers and:
numbers = [7, 3, 10, 1, 9]
1. Append a new number
2. Remove the smallest number
3. Sort the list
4. Print the final list
🔗 6. Working with tuple
Q6: Create a tuple of three cities
cities = ("Delhi", "Mumbai", "Kolkata")
1. Print the second city
2. Check if "Chennai" is in the tuple
3. Try to change one city (observe the error)
🧊 7. Understanding None
Q7: What does `None` mean in Python?
x = None
1. Print the type of x
2. Check if x is equal to 0
3. Write a condition: if x is None, print "No value assigned"
🧠 BONUS: Combine multiple data types
Q8: Create a list of mixed data types
info = [101, "Alice", 5.6, None, (1, 2), [3, 4]]
1. Print the type of each element
2. Count how many elements are strings or None
Nesta página do site você pode assistir ao vídeo on-line Python Lecture 4-: Python Data Types-"int, float, complex, str, list, tuple, dict.. duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário LearnnCoach 25 Maio 2025, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 19 vezes e gostou 1 espectadores. Boa visualização!