Computer Science: Python Programming Basics
Python fundamentals — variables, data types, control flow, functions, and basic OOP.
Study these flashcards with spaced repetition
Track your progress, master difficult cards, and export to Anki. Free to start.
Start Studying — FreeFlashcards in This Deck
What is the fundamental difference between a Python list and a Python tuple?
Lists are mutable, meaning their elements can be changed after creation, while tuples are immutable and cannot be modified once defined.
Explain the concept of 'dynamic typing' in Python.
Dynamic typing means that the type of a variable is determined at runtime based on the value assigned to it, rather than being explicitly declared by the programmer.
What does the string method .strip() accomplish?
The .strip() method removes all leading and trailing whitespace (including spaces, tabs, and newlines) from a string.
Describe the output of the range(start, stop, step) function.
It generates an immutable sequence of integers starting from 'start', incrementing by 'step', and ending just before 'stop' is reached.
What is the primary benefit of using the 'with' statement when opening files?
The 'with' statement acts as a context manager that ensures the file is properly closed automatically after the block finishes, even if an exception occurs.
What is the purpose of the __init__ method in a Python class?
The __init__ method is a constructor that initializes a new instance of a class by setting its initial state or attributes.
How do Python sets differ from lists regarding element uniqueness and ordering?
Sets are unordered collections that automatically enforce uniqueness, meaning they cannot contain duplicate elements, whereas lists maintain order and allow duplicates.
Explain the functionality of the .join() string method.
The .join() method takes an iterable (like a list) and concatenates its elements into a single string, using the string it was called on as the separator.
In a 'for' loop, when does the 'else' block execute?
The 'else' block executes only if the loop completes all its iterations naturally without being interrupted by a 'break' statement.
Write the general syntax for a list comprehension that includes a conditional filter.
[expression for item in iterable if condition]
+10 more cards — sign up to see all
Frequently Asked Questions
How many flashcards are in this Computer Science: Python Programming Basics deck?
This deck contains 20 flashcards with a mix of difficulty levels: 6 easy, 10 medium, and 4 hard cards.
Is this flashcard deck free to use?
Yes! You can study these flashcards for free with our spaced repetition system. Create a free account to track your progress and save your study history.
Can I export these flashcards to Anki?
Pro users can export any deck to Anki (.apkg format) with one click. Free users can export to CSV. Start studying for free and upgrade when you need Anki export.
What is spaced repetition?
Spaced repetition is a study technique that shows you cards at increasing intervals based on how well you know them. Cards you struggle with appear more often, while mastered cards are shown less frequently. This is proven to be one of the most effective ways to memorize information.
Related Flashcard Decks
Ready to study?
Create a free account and start studying these flashcards with spaced repetition.
Get Started — Free