Python questions

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/42

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 12:59 AM on 3/31/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

43 Terms

1
New cards

What is the correct file extension for Python files?

.py

2
New cards

What is a correct command line syntax for checking if python is installed on your computer? (And also to check the Python version)

python --version

3
New cards

What is a correct syntax to exit the Python command line interface?

exit()

4
New cards

T/F: Indentation in Python is for readability only.

False

5
New cards

T/F: Statements are executed one by one, in the same order as they are written

True

6
New cards

T/F: Semicolons are optional in Python. You can write multiple statements on one line by separating them with one

True

7
New cards

What is the output of the following code:

print("Python is fun!") print("Really!")

Error

8
New cards

The character used to define a single-line Python comment:

#

9
New cards

The character used to define a multi-line Python comment:

“““

10
New cards

What is the output of the following code:

print("Hello World!", end=" ")
print("I will print on the same line.")

Hello World! I will print on the same line.

11
New cards

What is the output of the following code: print(3 * 5)

15

12
New cards

What is the output of the following code: print("I am", 35, "years old.")

I am 35 years old

13
New cards

What is a correct way to declare a Python variable x = 5?

x = 5

14
New cards

What is a correct way to declare Python variable y = “Hello, World!”

y = “Hello, World!”

15
New cards

T/F: You can declare string variables with single or double quotes.

True

16
New cards

T/F: Variable names are not case-sensitive.

False

17
New cards

T/F: This is a legal variable name: 2myvar = "John"

False

18
New cards

T/F: This is a legal variable name my-var = "John"

False

19
New cards

T/F: This is a legal variable name MYVAR = "John"

True

20
New cards

What is the output of the following code:

x, y, z = "Orange", "Banana", "Cherry"
print(x)
print(y)
print(z)

Orange

Banana

Cherry

21
New cards

What is the output of the following code:

x = y = z = "Orange"

print(x)
print(y)
print(z)

Orange

Orange

Orange

22
New cards

What is the output of the following code:

fruits = ["apple", "banana", "cherry"]
x, y, z = fruits

print(x)
print(y)
print(z)

apple

banana

cherry

23
New cards

What is the output of the following code:

x = "Python is awesome"
print(x)

Python is awesome

24
New cards

What is the output of the following code:

x = "Python "
y = "is "
z = "awesome"
print(x + y + z)

Python is awesome

25
New cards

What is the output of the following code:

x = 5
y = 10
print(x + y)

15

26
New cards

What is the output of the following code:

x = 5
y = "John"
print(x + y)

Error

27
New cards

What is the output of the following code:

x = 5
y = "John"
print(x, y)

5 John

28
New cards

What is the output of the following code:

x = "awesome"

def myfunc():
  print("Python is " + x)

myfunc()

Python is awesome

29
New cards

What is the output of the following code:

x = "awesome"

def myfunc():
  x = "fantastic"
  print("Python is " + x)

myfunc()

print("Python is " + x)

Python is fantastic

Python is awesome

30
New cards

What is the output of the following code:

def myfunc():
  global x
  x = "fantastic"

myfunc()

print("Python is " + x)

Python is fantastic

31
New cards

What is the output of the following code:

x = "awesome"

def myfunc():
  global x
  x = "fantastic"

myfunc()

print("Python is " + x)

Python is fantastic

32
New cards

What is the output of the following code:

x = 5
y = "John"
print(type(x))
print(type(y))

5

John

33
New cards

Fill in the blanks: _____(_____(myvar))

print, type

34
New cards

Fill in the blanks for a variable named “carname” with assigned value “Volvo”:

_____ = _____

carname, “Volvo”

35
New cards

Text data type:

str

36
New cards

Numeric data types:

int, float, complex

37
New cards

Sequence data types:

list, tuple, range

38
New cards

Mapping data type:

dict

39
New cards

Set data types:

set, frozenset

40
New cards

Boolean data type:

bool

41
New cards

Binary data types:

bytes, bytearray, memoryview

42
New cards

None data type:

none

43
New cards

T/F: You can get the data type of any object by using the type() function:

True

Explore top notes

note
Chapter 4: Forces and Energy
Updated 1218d ago
0.0(0)
note
Unit 8: Ecology
Updated 95d ago
0.0(0)
note
Day 3
Updated 499d ago
0.0(0)
note
Chapter 13: Illicit Drugs
Updated 1092d ago
0.0(0)
note
excretory system notes
Updated 1176d ago
0.0(0)
note
Chapter 4: Forces and Energy
Updated 1218d ago
0.0(0)
note
Unit 8: Ecology
Updated 95d ago
0.0(0)
note
Day 3
Updated 499d ago
0.0(0)
note
Chapter 13: Illicit Drugs
Updated 1092d ago
0.0(0)
note
excretory system notes
Updated 1176d ago
0.0(0)

Explore top flashcards

flashcards
Flashcards pro zeměpis
80
Updated 316d ago
0.0(0)
flashcards
VET213 LAB END PRACTICAL SP2023
33
Updated 1064d ago
0.0(0)
flashcards
Criminology Unit 3
20
Updated 1234d ago
0.0(0)
flashcards
Econ Exam 2
66
Updated 1121d ago
0.0(0)
flashcards
W27 vocab (Klinh + Btram)
45
Updated 418d ago
0.0(0)
flashcards
El tiempo/ Que tiempo hace?
21
Updated 1204d ago
0.0(0)
flashcards
confirmation
32
Updated 980d ago
0.0(0)
flashcards
Speedtest Fische
25
Updated 62d ago
0.0(0)
flashcards
Flashcards pro zeměpis
80
Updated 316d ago
0.0(0)
flashcards
VET213 LAB END PRACTICAL SP2023
33
Updated 1064d ago
0.0(0)
flashcards
Criminology Unit 3
20
Updated 1234d ago
0.0(0)
flashcards
Econ Exam 2
66
Updated 1121d ago
0.0(0)
flashcards
W27 vocab (Klinh + Btram)
45
Updated 418d ago
0.0(0)
flashcards
El tiempo/ Que tiempo hace?
21
Updated 1204d ago
0.0(0)
flashcards
confirmation
32
Updated 980d ago
0.0(0)
flashcards
Speedtest Fische
25
Updated 62d ago
0.0(0)