Loading...
Quiz: Variables, Data Types, Strings and Booleans
Test your Python knowledge with this quiz on variables, data types, strings, and Booleans.
1.
Which of the following correctly defines a variable in Python?
2.
What will be the output of the following code?
python
3 lines
|7/ 500 tokens
1 2 3x = 5 x = "Hello" print(x)
Code Tools
3.
What will be the output of this code?
python
3 lines
|16/ 500 tokens
1 2 3fruits = ["Apple", "Banana", "Cherry"] x, y, z = fruits print(y)
Code Tools
4.
Which of the following is a legal Python variable name?
5.
What is the result of this string slicing?
python
2 lines
|10/ 500 tokens
1 2text = "Hello, World!" print(text[2:5])
Code Tools
6.
What will this code print?
python
2 lines
|9/ 500 tokens
1 2print(bool("Hello")) print(bool(0))
Code Tools