0
0
Pythonprogramming~20 mins

What is Python - Practice Questions & Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Python Beginner Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:00remaining
What is Python primarily used for?

Python is a popular programming language. What is its main use?

ABuilding websites and web applications
BCooking recipes automatically
CDesigning physical buildings
DDriving cars without a driver
Attempts:
2 left
💡 Hint

Think about what programming languages help create.

Predict Output
intermediate
1:30remaining
What is the output of this Python code?

Look at this code and tell what it prints:

print(type('Hello'))
Python
print(type('Hello'))
A<class 'int'>
B<class 'str'>
CHello
DSyntaxError
Attempts:
2 left
💡 Hint

What type is a text inside quotes in Python?

Predict Output
advanced
1:30remaining
What is the output of this Python code snippet?

What does this code print?

def greet(name):
    return f"Hello, {name}!"

print(greet('Alice'))
Python
def greet(name):
    return f"Hello, {name}!"

print(greet('Alice'))
AHello, name!
BTypeError
CHello, Alice!
Dgreet('Alice')
Attempts:
2 left
💡 Hint

Look at how the function uses the name inside the string.

🧠 Conceptual
advanced
1:00remaining
Which of these is NOT a feature of Python?

Python has many features. Which one below is NOT true about Python?

AIt is easy to read and write
BIt can run on many operating systems
CIt supports multiple programming styles
DIt requires manual memory management like C
Attempts:
2 left
💡 Hint

Think about how Python handles memory compared to lower-level languages.

Predict Output
expert
1:30remaining
What is the output of this Python code with a walrus operator?

What does this code print?

nums = [1, 2, 3, 4, 5]
if (n := len(nums)) > 3:
    print(f"List has {n} items")
else:
    print("List is small")
Python
nums = [1, 2, 3, 4, 5]
if (n := len(nums)) > 3:
    print(f"List has {n} items")
else:
    print("List is small")
AList has 5 items
BList is small
CSyntaxError
DTypeError
Attempts:
2 left
💡 Hint

The walrus operator assigns and returns the value in one step.