
Introduction to Python Programming

Quiz
•
Computers
•
9th Grade
•
Hard

Andrew Powell
Used 14+ times
FREE Resource
8 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following Python code do? if user == "Elizabeth": print("Good morning Your Majesty") else: print("Hello", user)
Checks if the user is Elizabeth and prints a personalized greeting.
Prints "Hello" followed by the user's name for all inputs.
Compares if two variables are equal.
Always prints "Good morning Your Majesty."
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which operator checks if two values are not equal in Python?
==
!=
<
>=
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following code output if the input is 13? lucky = 13 print("Guess my number:") guess = int(input()) if guess == lucky: print("Amazing, you guessed it") else: print("Sorry, it's not", guess)
"Amazing, you guessed it"
"Sorry, it's not 13"
"My lucky number is 13"
No output
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of importing the randint function from the random module?
To allow the program to compare two numbers.
To generate random integers within a specified range.
To check if a condition is true or false.
To handle user input more effectively.
5.
FILL IN THE BLANK QUESTION
30 sec • 1 pt
Fill in the blank to complete the code for rolling a dice: from random import randint diceroll = _______ print("You rolled a", diceroll)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following code output if diceroll equals 4? from random import randint diceroll = 4 if diceroll > 3: print(diceroll, "is a large roll") else: print(diceroll, "is a small roll")
"4 is a large roll"
"4 is a small roll"
No output
"Yet you rolled a 4"
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
True or False: The output of the following code will always be the same. from random import randint diceroll = randint(1,6) print("You rolled a", diceroll)
True
False
8.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code when coin is 0? from random import randint coin = randint(0,1) if coin == 0: result = "heads" print(result) else: result = "tails"
"heads"
"tails"
"Either heads or nothing"
"Either heads or tails"
Similar Resources on Wayground
11 questions
Python Code Quiz

Quiz
•
8th - 12th Grade
10 questions
Java Print Statements Warm-Up

Quiz
•
9th - 12th Grade
8 questions
Одномерный массив

Quiz
•
9th Grade
12 questions
Java Strings

Quiz
•
9th - 12th Grade
10 questions
Python Variables

Quiz
•
7th - 12th Grade
10 questions
Shortcuts

Quiz
•
5th - 10th Grade
10 questions
Year 9 lower Python

Quiz
•
9th Grade
10 questions
ข้อสอบไพทอน

Quiz
•
9th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
20 questions
Analog vs Digital

Quiz
•
9th - 12th Grade
10 questions
Exploring Cybersecurity Techniques and Threats

Interactive video
•
6th - 10th Grade
10 questions
Understanding the Internet and Data Transmission

Interactive video
•
7th - 12th Grade