Python PCEP Flashcard #2

Python PCEP Flashcard #2

Assessment

Flashcard

Science

6th - 8th Grade

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

15 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What is a List in Python?

Back

A List is a data type in Python that is used to store multiple items in a single variable. Lists are ordered, changeable, and allow duplicate values. Example: x = [1, 2, 3]

2.

FLASHCARD QUESTION

Front

What is the output of the following code: numbers = [5, 14, 9, 17]; for number in numbers: if number % 3 == 0: print(number)?

Back

The output will be 9, as it is the only number in the list that is divisible by 3.

3.

FLASHCARD QUESTION

Front

What does the expression 'number > 7' evaluate to if number is 10?

Back

The expression evaluates to True, as 10 is greater than 7.

4.

FLASHCARD QUESTION

Front

What symbol is used in Python to assign values to a variable?

Back

The equals sign '=' is used to assign values to a variable in Python.

5.

FLASHCARD QUESTION

Front

What is a Dictionary in Python?

Back

A Dictionary is a data type in Python that stores data in key-value pairs. Example: x = {'a': 1, 'b': 2}.

6.

FLASHCARD QUESTION

Front

What is a Tuple in Python?

Back

A Tuple is a data type in Python that is similar to a list but is immutable (cannot be changed). Example: x = (1, 2, 3).

7.

FLASHCARD QUESTION

Front

What is the difference between a List and a Tuple?

Back

The main difference is that Lists are mutable (can be changed) while Tuples are immutable (cannot be changed).

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?