Search Header Logo

Using Comparison Operators and if-else-elif with Input in Python

Authored by Bryan William

Computers

7th Grade

Used 2+ times

Using Comparison Operators and if-else-elif with Input in Python
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will the following code output if the user inputs 25?

  • A) You are an adult.

  • B) You are not an adult.

  • C) Error

  • D) No output

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which operator is used to check if two values are not equal?

  • A) ==

  • B) <=

  • C) !=

  • D) >=

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will the following code output if the user enters 72?

  • A) Grade: A

  • B) Grade: B

  • C) Grade: C

  • D) Grade: F

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of using elif in an if-else structure?

  • A) To specify what happens if the if condition is True.

  • B) To specify what happens if all previous conditions are False.

  • C) To check another condition if the previous if condition is False.

  • D) To always execute a block of code.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will the following code output if the user inputs -5?

  • A) The number is positive.

  • B) The number is negative.

  • C) The number is zero.

  • D) Error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

6. Which comparison operator would you use to check if a value is less than or equal to another value?

  • A) >

  • B) <

  • C) >=

  • D) <=

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is the result of the following comparison?

  • A) True

  • B) False

  • C) Error

  • D) No output

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers