Programming flashcards

Python Basics: Syntax & Data Types

A friendly Python starter deck covering variables, collections, functions, and control flow.

10 cards By @mazo
#python#programming#syntax#basics
Study this deck Browse Programming

Card preview

Card 1 How do you write a comment in Python?

Start the line with #.

Card 2 What is a list?

An ordered, mutable collection: items = [1, 2, 3].

Card 3 What is a tuple?

An ordered, immutable collection: point = (2, 4).

Card 4 What is a dictionary?

A key-value collection: user = {"name": "Ana"}.

Card 5 How do you define a function?

Use def: def greet(name): return f"Hi {name}".

Card 6 What does len(items) return?

The number of items in a collection.

Card 7 What is indentation used for?

It defines code blocks such as loops, functions, and conditionals.

Card 8 How do you loop over a list?

for item in items: ...