Python Programming Flashcard

Python Programming Flashcard

Assessment

Flashcard

Computers

University

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

15 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What is the output of the following code: print(list(range(2, 10, -2)))?

Back

[]

2.

FLASHCARD QUESTION

Front

What will be the output of the following Python code?
def func(x, y=[]):
y.append(x)
return y
print(func(1))
print(func(2))
print(func(3, []))
print(func(4))

Back

[1]
[1, 2]
[3]
[1, 2, 4]

3.

FLASHCARD QUESTION

Front

What will be the output of the following Python code?
s = "hello-world-python"
result = s.split("-") # Splits the string at '-'
output = " | ".join(result) # Joins the split parts with ' | '
print(output)

Back

'hello | world | python'

4.

FLASHCARD QUESTION

Front

What will be the output of the following code?
s = "Python is amazing"
x = s.partition("is")
output = "#".join(x)
print(output)

Back

'Python#is#amazing' (Using partition() and join())

5.

FLASHCARD QUESTION

Front

Which of the following Python data types is immutable? List, Tuple, Dictionary, None of the above

Back

Tuple

6.

FLASHCARD QUESTION

Front

Which of the following operations will result in an error when performed on a Python list? my_list.append(5), my_list[2] = "new_value", my_list.sort(), my_list[5.5] = "error"

Back

my_list[5.5] = "error"

7.

FLASHCARD QUESTION

Front

What will be the output of the following Python snippet?
text = "Hello, Python!"
print(text[text.find("P"):text.find("n")+1])

Back

"Python"

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?