Public Deck

Python Programming - 50 Essentials

Master Python fundamentals with 50 cards covering syntax, data structures, OOP, and commonly used libraries and patterns.

AnyFlashcards50 cards

Preview

Front

How do you write a single-line comment in Python?

Back

Using the hash symbol (#) # This is a comment

Front

What is the primary way Python indicates code blocks?

Back

Indentation Consistent whitespace (usually 4 spaces) defines scope.

Front

How do you create a multi-line string in Python?

Back

Triple quotes (''' or """) """This spans multiple lines"""

Front

How do you format a string using an f-string?

Back

Prefix the string with 'f' and use curly braces f"Hello {name}"

Front

What are the three logical operators in Python?

Back

and, or, not if x > 0 and y < 0:

Front

How do you write an 'else if' statement in Python?

Back

elif if x > 0: ... elif x < 0: ...

Front

What does the 'break' statement do in a loop?

Back

Terminates the current loop immediately while True: break

Front

What does the 'continue' statement do in a loop?

Back

Skips the rest of the current iteration for i in range(5): continue

Front

What is the purpose of the 'pass' statement?

Back

A null placeholder for syntactically required code def my_func(): pass

Front

How do you check the data type of a variable?

Back

type() function type(42) # returns <class 'int'>

+ 40 more cards

Related Flashcard Decks

Ready to study?

Sign up for free to copy this deck and start learning with spaced repetition.

Get started for free