Back to All Flashcards
Card 1 of 5 0%
0Hard
0Learning
0Know It
Question
Loading…
Click to reveal answer
Answer
All 5 Cards
#1
Q: How do you declare a list in Python?
A: my_list = [1, 2, 3]
#2
Q: How do you iterate over a list?
A: for item in my_list: (use a for loop)
#3
Q: How do you define a function in Python?
A: def my_function(param): ...
#4
Q: How do you handle an exception?
A: try: ... except ExceptionType as e: ...
#5
Q: What does len() do?
A: Returns the number of items in a sequence (list, string, etc.).
Explore All 125 Free Decks