Python

Lesson 9 of 10

Quiz ยท 8 min

Quiz, Python basics

Answer all ten questions, then press Check my answers. You need 70% to pass. If you do not pass, read the explanations and try again.

Question 1 of 10

Which line makes a variable named score with the value 10?

Question 2 of 10

What is the value of 7 // 2?

Question 3 of 10

What does this code print?

name = "Sam"
print(f"Hi, {name}!")
Question 4 of 10

What is "python"[0]?

Question 5 of 10

Which part of this code is required for the code to work?

if score >= 50:
    print("Pass")
Question 6 of 10

Which numbers does range(2, 6) give?

Question 7 of 10

What is scores[-1] when scores = [10, 7, 9]?

Question 8 of 10

You have pet = {"name": "Biscuit"}. What does pet.get("age", 0) give?

Question 9 of 10

Which statements about return are true? Choose all that apply.

Choose all answers that apply.

Question 10 of 10

What does this function give for power(3)?

def power(base, exponent=2):
    return base ** exponent

Answer every question to check.