Term
print() and input() in Python?Definition
print() is used to display output to the console, while input() is used to get user input from the console, typically as a string.Master Python fundamentals and core computer science principles with this comprehensive flashcard deck, mirroring Stanford CS106A. Dive into syntax, control flow, functions, data structures, OOP, and essential algorithms to build a strong programming foundation.
A quick, read-only look at the deck content.
Term
print() and input() in Python?Definition
print() is used to display output to the console, while input() is used to get user input from the console, typically as a string.Term
Definition
list, dict, set). Immutable types cannot be changed after creation; any 'modification' creates a new object (e.g., int, float, str, tuple).Term
return statement?Definition
def keyword, followed by the function name, parameters in parentheses, and a colon. The return statement sends a value back to the caller and exits the function. If omitted, the function implicitly returns None.Term
if-elif-else statement in Python.Definition
if-elif-else statement allows conditional execution based on boolean conditions.if condition1:
# code if condition1 is true
elif condition2:
# code if condition1 is false and condition2 is true
else:
# code if all conditions are falseTerm
for loop used for in Python? Provide an example iterating over a list.Definition
for loop is used to iterate over a sequence (like a list, tuple, string, or range) or other iterable objects.my_list = [10, 20, 30]
for item in my_list:
print(item)Term
while loop instead of a for loop?Definition
while loop is used when the number of iterations is not known beforehand and depends on a condition remaining true. A for loop is typically used when iterating over a known sequence or a fixed number of times.Term
Definition
my_list[0]). Slicing allows accessing a sub-sequence of a list using my_list[start:end:step], creating a new list.Term
Definition
my_dict = {"name": "Alice", "age": 30}
# Access
print(my_dict["name"]) # Output: Alice
# Add/Modify
my_dict["city"] = "New York"Explore similar study materials created by the community
Embark on your French language adventure with this essential A1 vocabulary and phrase deck! Master key greetings, introductions, common verbs, and daily expressions to confidently navigate basic conversations.
Master Kubernetes core concepts and deployment strategies with this high-yield flashcard deck. Dive into Pods, Deployments, Services, and advanced features to confidently orchestrate your containerized applications.
Master complex organic reaction mechanisms, multi-step synthesis, and retrosynthetic strategies. This deck covers advanced topics like pericyclic reactions, Grignard reagents, Wittig reactions, and stereochemical control to elevate your organic chemistry expertise.
Master essential networking concepts for the CompTIA Network+ (N10-008) exam. This high-yield deck covers network architecture, protocols, security, and troubleshooting to ensure your certification success.