Python Coding Basics Flashcards
6 cards from real Online Coding Lessons practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Python Coding Basics flashcards as text
How do you import a module in Python?
Answer: import math
Python uses the 'import' keyword to bring in modules that provide additional functionality.
What does the 'range(5)' function return in Python?
Answer: [0, 1, 2, 3, 4]
range(5) generates a sequence starting from 0 up to but not including 5, producing 0, 1, 2, 3, 4.
Which method is used to add an item to the end of a Python list?
Answer: .append()
The .append() method adds a single item to the end of a Python list.
What is a Python dictionary?
Answer: A collection of key-value pairs
A Python dictionary is a collection of key-value pairs where each unique key maps to a value.
What is the Boolean value of an empty string in Python?
Answer: False
An empty string '' is considered 'falsy' in Python and evaluates to False in a Boolean context.
What does the 'pass' statement do in Python?
Answer: Does nothing and acts as a placeholder
The 'pass' statement is a null operation used as a placeholder where code is syntactically required but no action is needed.