Search Header Logo

Python Basics: Constants, Variables, and More

Authored by Martin Bishell

Computers

9th Grade

Used 1+ times

Python Basics: Constants, Variables, and More
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

Which of the following is a correct way to define a constant in Python?

`const PI = 3.14`

`PI = 3.14`

`constant(PI) = 3.14`

`#define PI 3.14`

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to declare a variable `x` with the value `10` in Python?

`int x = 10`

`x := 10`

`x = 10`

`var x = 10`

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is used to print a message in Python?

`print("Hello, World!")`

`echo "Hello, World!"`

`System.out.println("Hello, World!")`

`printf("Hello, World!")`

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following data types does not exist in Python?

`list`

`tuple`

`array`

`set`

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you concatenate two strings, `a` and `b`, in Python?

`a + b`

`a.concat(b)`

`concat(a, b)`

`a & b`

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code snippet? `print("Python"[1:3])`

`Pyt`

`yth`

`yt`

`tho`

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to convert the string `"123"` to an integer in Python?

`int("123")`

`parseInt("123")`

`"123".toInt()`

`convert.toInt("123")`

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?