Practice Examples In Python (33.8.1) - Global scope, nested functions - Data Structures and Algorithms in Python
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

Examples in Python

Practice - Examples in Python

Learning

Practice Questions

Test your understanding with targeted questions

Question 1 Easy

Define a variable a with the value 10. What command would you use to print it?

💡 Hint: Remember to use the print function!

Question 2 Easy

What type of data would string_var = 'Hello, World!' be?

💡 Hint: Think about how to denote a string in Python.

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What does the following code print? x = 'Hello'; print(x)

Hello
x
None

💡 Hint: Consider what is stored in the variable x.

Question 2

True or False: Lists in Python start indexing at 1.

True
False

💡 Hint: Think about the first element in a list.

1 more question available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Construct a function compute_area that takes width and height as parameters and returns the area of a rectangle. Provide a code snippet to illustrate your function.

💡 Hint: Recall the formula for the area of a rectangle.

Challenge 2 Hard

Implement error handling to safely read a number from input, dividing 100 by that number. Ensure the program handles division by zero.

💡 Hint: Consider how to ask the user for input and catch any potential errors.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.