Help
Contact
For teachers and institutes
Search courses, problems, tests…
A
A
>_
StemPy Lab
Courses ▾
Problems ▾
Practice ▾
Mock Tests
Classes
Groups
Community ▾
A
A
Problems
/
Python Basics
/
Variables and Data Types
Variables and Data Types
Python Programming
+ Upload a Problem
More in Python Basics
Getting Started with Python
Variables and Data Types
Operators and Expressions
Input and Output
Strings
Conditionals: if, elif, else
Loops
Lists
Functions
Mini Projects
All Levels
Middle Stage (6–8)
High School (9–10)
High School (11–12)
Undergraduate
General
All
Easy
Medium
Sort
Mixed
Newest first
Oldest first
A to Z
14 problems
Type:
Any
Conceptual
Numerical
Python-Coded
1.
Each of these three programs stops with an error.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Easy
2.
Say what the type of each result is, and what value it has. Decide on paper first.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Medium
3.
A student wants to swap a and b, and writes…
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Easy
4.
Trace the program
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Medium
5.
score = 10 and then Score = 99. What does print(score, Score) show? Are these the same variable?
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Easy
6.
Each name below is wrong. Say why, and write a correct name.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Medium
7.
What do these lines show? print(5 > 3), print(2 == 3), print("a" == "a"), print(type(5 > 3)).
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Medium
8.
age_text = "12" and age_number = 12. What is the difference?
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Medium
9.
a = 3 and b = 8. Write code that swaps them, so that a is 8 and b is 3.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Medium
10.
A game score starts at 0. The player gets 10 points, then 5 points, and then the score is doubled.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Easy
11.
Follow the values
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Medium
12.
Give the type (int, float, str or bool) of each value: 7, 7.0, "7", True, 3 > 2.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Easy
13.
Which of these are valid variable names?
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Easy
14.
Store your name, your age and your city in three variables.
Middle Stage (6–8), High School (9–10), High School (11–12), Undergraduate, General · Variables and Data Types
StemPy Lab
Easy