Introduction to Python Programming
Grade 6 · Technology · Study Guide
Learn the basics of Python, one of the world's most popular programming languages.
Python is a high-level programming language created by Guido van Rossum and first released in 1991. It is known for its simple, readable syntax that uses plain English words, making it a great first language for beginners.
In Python, you write instructions called code that the computer executes one line at a time. A program is simply a list of these instructions. You can display text on the screen using the print() function — for example, print("Hello, World!") outputs the words Hello, World!.
Variables are like labeled boxes that store information. You create a variable by giving it a name and assigning a value with the equals sign: age = 12. Python has several data types including integers (whole numbers like 5), strings (text surrounded by quotes like "hello"), and booleans (True or False).
Python programs can make decisions using if statements. For example, if age > 10: print("Middle schooler") only prints when the condition is true. Loops let you repeat code: a for loop runs a block of code a set number of times, while a while loop keeps running as long as a condition is true.
Python is used in web development, data science, artificial intelligence, and game development, making it one of the most versatile languages to learn.
Key terms
- syntax
- The set of rules that define how Python code must be written so the computer can understand it.
- variable
- A named container that stores a value which can be used and changed throughout a program.
- function
- A reusable block of code that performs a specific task, like print() which displays output.
- string
- A data type used to represent text, always enclosed in single or double quotation marks.
- loop
- A programming structure that repeats a block of code multiple times until a condition is met.
- boolean
- A data type that can only be True or False, often used in conditions and comparisons.
Flashcards
- print()
- Built-in Python function that displays output to the screen.
- integer
- A whole number data type in Python, such as 0, 5, or -3.
- if statement
- A conditional structure that runs code only when a specified condition is True.
- for loop
- A loop that iterates over a sequence (like a list or range) a set number of times.
- while loop
- A loop that continues running as long as its condition remains True.
- comment
- A note in code starting with # that Python ignores; used to explain the code to humans.
- data type
- The category of a value, such as integer, string, float, or boolean.
- indentation
- The spaces or tabs at the beginning of a line that Python uses to define code blocks.
Questions
Which function is used to display output on the screen in Python?
- display()
- print()
- show()
- output()
Show answer
Answer: print()
print() is Python's built-in function for displaying output. The others — display(), show(), and output() — are not standard Python functions.
In Python, a variable name can begin with a number.
Show answer
Answer: False
Python variable names must start with a letter or underscore. Starting with a number causes a syntax error.
The data type that stores text in Python is called a ______.
Show answer
Answer: string
Strings are the text data type in Python and are always wrapped in single or double quotation marks.
What symbol is used to assign a value to a variable in Python?
- ==
- ->
- =
- :
Show answer
Answer: =
The single equals sign (=) assigns a value to a variable. The double equals (==) is used to compare two values.
Python was created in the 1990s.
Show answer
Answer: True
Python was created by Guido van Rossum and first released in 1991, which is in the early 1990s.
Get a personalized course on Python Programming Introduction built around your child.