
Python - String and Lists
Authored by Anik Acharjee
Computers
Professional Development
Used 6+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
str1 = "Hello World"
result = ""
for char in str1:
if char.isalpha():
result += char.lower()
else:
result += char
print(result)
What will be the output of the above code?
hello world
HELLO WORLD
Hello World
hELLO wORLD
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
str2 = "Python is awesome"
result = ""
for i in range(len(str2)):
if i % 2 == 0:
result += str2[i].upper()
else:
result += str2[i].lower()
print(result)
What will be the output of the above code?
PyThOn iS AwEsOmE
pYtHoN iS AwEsOmE
PYTHON IS AWESOME
PytHon Is aWesoMe
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
str3 = "12345"
result = ""
for char in str3:
result += str(int(char) * 2)
print(result)
What will be the output of the above code?
246810
13579
Typecasting Error
12345246810
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
str4 = "Good Morning"
result = ""
for char in str4:
if char.isalpha():
result += char
print(result)
What will be the output of the above code?
Good Morning
GdMrng
Morning
GoodMorning
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
str5 = "abcdefg"
result = ""
for i in range(len(str5)):
if i % 2 != 0:
result += str5[i]
print(result)
What will be the output of this code?
bdfg
aceg
abcdefg
bdf
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
my_list = [1, 2, 3, 4, 5]
if len(my_list) > 3:
result = my_list[:3]
else:
result = my_list[::-1]
print(result)
What will be the output of the above code?
[1, 2, 3]
[5, 4, 3, 2, 1]
[1, 2, 3, 4, 5]
[1, 2]
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
my_list = [1, 2, 3, 4, 5]
if sum(my_list) > 20:
result = my_list[-1] * 2
else:
result = my_list[2]**2 + my_list[-2]**2
print(result)
What will be the output of this code?
7
10
25
2
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
m1-html-css-js
Quiz
•
KG - Professional Dev...
20 questions
Dev Web Java / Angular
Quiz
•
Professional Development
16 questions
CPU scheduling
Quiz
•
Professional Development
15 questions
coding
Quiz
•
KG - Professional Dev...
20 questions
MS OFFICE QUIZ 01
Quiz
•
Professional Development
15 questions
JS
Quiz
•
Professional Development
15 questions
24/01/2024
Quiz
•
Professional Development
20 questions
Round-1 Technical Aptitude
Quiz
•
11th Grade - Professi...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Computers
10 questions
How to Email your Teacher
Quiz
•
Professional Development
6 questions
3RD GRADE DECLARATION OF INDEPENDENCE EXIT TICKET
Quiz
•
Professional Development
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
22 questions
Multiplying Exponents with the Same Base
Quiz
•
9th Grade - Professio...
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...