Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
Define a variable for your favorite color.
Think of your favorite color enclosed in quotes.
What variable type does age = 25 represent?
Consider if it’s a whole number or not.
What is the output of the following code: name = "Alice"; print(name)?
Check how strings are printed in Python.
True or False: In Python, variables must have predefined data types.
Consider if you can assign different types to the same variable.
Create a script that defines variables of all four types (string, integer, float, boolean). Then, print each variable along with its type.
Remember to use the print function to display each variable and its type.
Write a small program using variables to gather user input for their full name, age, height, and whether they are a student. Then, display all the details.
Use input() for user entries, and remember to convert types where necessary!
5 more questions in this section. Enroll free to practise them all.
Enroll free