Mastering Python Loops, Functions, and Lists
Flashcard
•
Information Technology (IT)
•
University
•
Hard
Wayground Content
FREE Resource
Student preview

8 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Which of the following is the correct syntax for a for loop that iterates over a list named `numbers` in Python? Options: `for numbers in i:`, `for i in numbers:`, `for i to numbers:`, `foreach i in numbers:`
Back
`for i in numbers:`
2.
FLASHCARD QUESTION
Front
What is the correct way to define a function in Python that takes no arguments and prints "Hello"? Options: `function hello(): print("Hello")`, `def hello(): print("Hello")`, `def hello: print("Hello")`, `function hello: print("Hello")`
Back
`def hello(): print("Hello")`
3.
FLASHCARD QUESTION
Front
Which of the following is a valid way to declare a single-dimensional array (list) of integers in Python? Options: `arr = [1, 2, 3, 4]`, `arr = (1, 2, 3, 4)`, `arr = {1, 2, 3, 4}`, `arr = <1, 2, 3, 4>`
Back
`arr = [1, 2, 3, 4]`
4.
FLASHCARD QUESTION
Front
Which of the following statements correctly creates a 2D array (list of lists) in Python? Options: `matrix = [[1, 2], [3, 4]]`, `matrix = ((1, 2), (3, 4))`, `matrix = {1, 2, 3, 4}`, `matrix = [1, 2, 3, 4]`
Back
`matrix = [[1, 2], [3, 4]]`
5.
FLASHCARD QUESTION
Front
What is the output of the following code?
```python
def add(a, b):
return a + b
print(add(2, 3))
```
Back
`5`
6.
FLASHCARD QUESTION
Front
Which of the following loop constructs will correctly print numbers from 10 down to 1? Options: for i in range(10,0,-1): print(i), for in range(1,10): print(i), for in range(10): print(i), for i in range(10,1-1): print(i)
Back
for i in range(10,0,-1):
print(i)
7.
FLASHCARD QUESTION
Front
Given the list `arr = [10, 20, 30, 40]`, which statement will change the second element to 25? Options: `arr[1] = 25`, `arr[2] = 25`, `arr[0] = 25`, `arr[3] = 25`
Back
`arr[1] = 25`
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
6 questions
IE 4 U5 lesson 5-6
Flashcard
•
12th Grade
10 questions
Tác động của quy luật giá trị
Flashcard
•
University
8 questions
Memorize Bible Verses
Flashcard
•
Professional Development
2 questions
Understanding the First Stanza
Flashcard
•
12th Grade
8 questions
Flashcard Set on Viruses
Flashcard
•
12th Grade - University
10 questions
Technology vocabulary
Flashcard
•
University
3 questions
Tuas Types
Flashcard
•
KG - University
9 questions
Pengujian Pepasangan Pendawaian
Flashcard
•
KG - University
Popular Resources on Wayground
8 questions
2 Step Word Problems
Quiz
•
KG - University
20 questions
Comparing Fractions
Quiz
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Latin Bases claus(clois,clos, clud, clus) and ped
Quiz
•
6th - 8th Grade
22 questions
fractions
Quiz
•
3rd Grade
7 questions
The Story of Books
Quiz
•
6th - 8th Grade
Discover more resources for Information Technology (IT)
8 questions
2 Step Word Problems
Quiz
•
KG - University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
10 questions
14.2 Independent/Dependent Variables
Quiz
•
KG - University
18 questions
Great Lakes States
Quiz
•
KG - University
7 questions
DNA, Chromosomes, Genes, and Traits: An Intro to Heredity
Interactive video
•
11th Grade - University
7 questions
Reflexive Verbs in Spanish
Lesson
•
9th Grade - University
7 questions
Narrative Writing 1
Interactive video
•
4th Grade - University