Open the App

Subjects

207

15 Dec 2025

2 pages

Learn Python Basics - Unit 4 Programming Introduction

Programming with Python involves understanding the fundamental building blocks that... Show more

Unit 4: Programming
Python exploration
Constructs
Constructs are elements of the programming language which include:
Command (reserved) word

Programming Constructs and Command Words

Programming constructs are like the grammar rules of coding - they're the essential elements that make up any Python program. Think of them as your coding toolkit, including command words, variables, data types, statements, and operators.

Command words (also called reserved words) are Python's sacred vocabulary that you absolutely cannot use for your own variables or functions. Words like if, while, def, and class are off-limits because Python needs them for specific tasks. It's like trying to name your dog "The" - it just won't work because that word already has a job!

Understanding global and local variables is crucial for avoiding frustrating bugs. Global variables can be accessed from anywhere in your program, whilst local variables only exist within their specific function or block of code. In the example, name = "Harry Westworth" is global (available everywhere), but age only exists inside the getAge() function.

Quick Tip: If you try using a reserved word as a variable name, Python will throw an error faster than you can say "syntax error"!

Unit 4: Programming
Python exploration
Constructs
Constructs are elements of the programming language which include:
Command (reserved) word

Python Operations and Data Structures

Python's data types cover everything from simple text (str) and numbers (int, float) to more complex structures like list, dict, and bool. These are the different containers that hold your data, each with their own special powers and limitations.

Control structures determine how your program flows - whether it runs sequentially (line by line), makes decisions with selection statements (if/else), or repeats actions through iteration (for/while loops). These are the traffic lights of your code, directing where it goes next.

Python operators are your mathematical and logical tools. Arithmetic operators like +, -, * handle maths, whilst assignment operators like += and -= provide shortcuts for updating variables. The ** operator handles powers, and // does floor division - handy shortcuts that save time and typing.

Key data structures like arrays, stacks, queues, and linked lists each solve different problems. Arrays store items in order, stacks work like a pile of plates (last in, first out), and queues work like, well, queues (first in, first out)!

Remember: Master these basics first - they're the foundation for everything else you'll build in Python!



We thought you’d never ask...

What is the Knowunity AI companion?

Our AI Companion is a student-focused AI tool that offers more than just answers. Built on millions of Knowunity resources, it provides relevant information, personalised study plans, quizzes, and content directly in the chat, adapting to your individual learning journey.

Where can I download the Knowunity app?

You can download the app from Google Play Store and Apple App Store.

Is Knowunity really free of charge?

That's right! Enjoy free access to study content, connect with fellow students, and get instant help – all at your fingertips.

Most popular content in Computer Science

Most popular content

Can't find what you're looking for? Explore other subjects.

Students love us — and so will you.

4.9/5

App Store

4.8/5

Google Play

The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.

Stefan S

iOS user

This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.

Samantha Klich

Android user

Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.

Anna

iOS user

Best app on earth! no words because it’s too good

Thomas R

iOS user

Just amazing. Let's me revise 10x better, this app is a quick 10/10. I highly recommend it to anyone. I can watch and search for notes. I can save them in the subject folder. I can revise it any time when I come back. If you haven't tried this app, you're really missing out.

Basil

Android user

This app has made me feel so much more confident in my exam prep, not only through boosting my own self confidence through the features that allow you to connect with others and feel less alone, but also through the way the app itself is centred around making you feel better. It is easy to navigate, fun to use, and helpful to anyone struggling in absolutely any way.

David K

iOS user

The app's just great! All I have to do is enter the topic in the search bar and I get the response real fast. I don't have to watch 10 YouTube videos to understand something, so I'm saving my time. Highly recommended!

Sudenaz Ocak

Android user

In school I was really bad at maths but thanks to the app, I am doing better now. I am so grateful that you made the app.

Greenlight Bonnie

Android user

very reliable app to help and grow your ideas of Maths, English and other related topics in your works. please use this app if your struggling in areas, this app is key for that. wish I'd of done a review before. and it's also free so don't worry about that.

Rohan U

Android user

I know a lot of apps use fake accounts to boost their reviews but this app deserves it all. Originally I was getting 4 in my English exams and this time I got a grade 7. I didn’t even know about this app three days until the exam and it has helped A LOT. Please actually trust me and use it as I’m sure you too will see developments.

Xander S

iOS user

THE QUIZES AND FLASHCARDS ARE SO USEFUL AND I LOVE THE SCHOOLGPT. IT ALSO IS LITREALLY LIKE CHATGPT BUT SMARTER!! HELPED ME WITH MY MASCARA PROBLEMS TOO!! AS WELL AS MY REAL SUBJECTS ! DUHHH 😍😁😲🤑💗✨🎀😮

Elisha

iOS user

This apps acc the goat. I find revision so boring but this app makes it so easy to organize it all and then you can ask the freeeee ai to test yourself so good and you can easily upload your own stuff. highly recommend as someone taking mocks now

Paul T

iOS user

The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.

Stefan S

iOS user

This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.

Samantha Klich

Android user

Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.

Anna

iOS user

Best app on earth! no words because it’s too good

Thomas R

iOS user

Just amazing. Let's me revise 10x better, this app is a quick 10/10. I highly recommend it to anyone. I can watch and search for notes. I can save them in the subject folder. I can revise it any time when I come back. If you haven't tried this app, you're really missing out.

Basil

Android user

This app has made me feel so much more confident in my exam prep, not only through boosting my own self confidence through the features that allow you to connect with others and feel less alone, but also through the way the app itself is centred around making you feel better. It is easy to navigate, fun to use, and helpful to anyone struggling in absolutely any way.

David K

iOS user

The app's just great! All I have to do is enter the topic in the search bar and I get the response real fast. I don't have to watch 10 YouTube videos to understand something, so I'm saving my time. Highly recommended!

Sudenaz Ocak

Android user

In school I was really bad at maths but thanks to the app, I am doing better now. I am so grateful that you made the app.

Greenlight Bonnie

Android user

very reliable app to help and grow your ideas of Maths, English and other related topics in your works. please use this app if your struggling in areas, this app is key for that. wish I'd of done a review before. and it's also free so don't worry about that.

Rohan U

Android user

I know a lot of apps use fake accounts to boost their reviews but this app deserves it all. Originally I was getting 4 in my English exams and this time I got a grade 7. I didn’t even know about this app three days until the exam and it has helped A LOT. Please actually trust me and use it as I’m sure you too will see developments.

Xander S

iOS user

THE QUIZES AND FLASHCARDS ARE SO USEFUL AND I LOVE THE SCHOOLGPT. IT ALSO IS LITREALLY LIKE CHATGPT BUT SMARTER!! HELPED ME WITH MY MASCARA PROBLEMS TOO!! AS WELL AS MY REAL SUBJECTS ! DUHHH 😍😁😲🤑💗✨🎀😮

Elisha

iOS user

This apps acc the goat. I find revision so boring but this app makes it so easy to organize it all and then you can ask the freeeee ai to test yourself so good and you can easily upload your own stuff. highly recommend as someone taking mocks now

Paul T

iOS user

 

Computer Science

207

15 Dec 2025

2 pages

Learn Python Basics - Unit 4 Programming Introduction

Programming with Python involves understanding the fundamental building blocks that make code work. These constructs include everything from basic data types to complex control structures that determine how your program flows and makes decisions.

Unit 4: Programming
Python exploration
Constructs
Constructs are elements of the programming language which include:
Command (reserved) word

Sign up to see the contentIt's free!

Access to all documents

Improve your grades

Join milions of students

By signing up you accept Terms of Service and Privacy Policy

Programming Constructs and Command Words

Programming constructs are like the grammar rules of coding - they're the essential elements that make up any Python program. Think of them as your coding toolkit, including command words, variables, data types, statements, and operators.

Command words (also called reserved words) are Python's sacred vocabulary that you absolutely cannot use for your own variables or functions. Words like if, while, def, and class are off-limits because Python needs them for specific tasks. It's like trying to name your dog "The" - it just won't work because that word already has a job!

Understanding global and local variables is crucial for avoiding frustrating bugs. Global variables can be accessed from anywhere in your program, whilst local variables only exist within their specific function or block of code. In the example, name = "Harry Westworth" is global (available everywhere), but age only exists inside the getAge() function.

Quick Tip: If you try using a reserved word as a variable name, Python will throw an error faster than you can say "syntax error"!

Unit 4: Programming
Python exploration
Constructs
Constructs are elements of the programming language which include:
Command (reserved) word

Sign up to see the contentIt's free!

Access to all documents

Improve your grades

Join milions of students

By signing up you accept Terms of Service and Privacy Policy

Python Operations and Data Structures

Python's data types cover everything from simple text (str) and numbers (int, float) to more complex structures like list, dict, and bool. These are the different containers that hold your data, each with their own special powers and limitations.

Control structures determine how your program flows - whether it runs sequentially (line by line), makes decisions with selection statements (if/else), or repeats actions through iteration (for/while loops). These are the traffic lights of your code, directing where it goes next.

Python operators are your mathematical and logical tools. Arithmetic operators like +, -, * handle maths, whilst assignment operators like += and -= provide shortcuts for updating variables. The ** operator handles powers, and // does floor division - handy shortcuts that save time and typing.

Key data structures like arrays, stacks, queues, and linked lists each solve different problems. Arrays store items in order, stacks work like a pile of plates (last in, first out), and queues work like, well, queues (first in, first out)!

Remember: Master these basics first - they're the foundation for everything else you'll build in Python!

We thought you’d never ask...

What is the Knowunity AI companion?

Our AI Companion is a student-focused AI tool that offers more than just answers. Built on millions of Knowunity resources, it provides relevant information, personalised study plans, quizzes, and content directly in the chat, adapting to your individual learning journey.

Where can I download the Knowunity app?

You can download the app from Google Play Store and Apple App Store.

Is Knowunity really free of charge?

That's right! Enjoy free access to study content, connect with fellow students, and get instant help – all at your fingertips.

1

Smart Tools NEW

Transform this note into: ✓ 50+ Practice Questions ✓ Interactive Flashcards ✓ Full Mock Exam ✓ Essay Outlines

Mock Exam
Quiz
Flashcards
Essay

Similar content

Essential SQL Commands

Master key SQL commands with this concise cheat sheet covering SELECT, INSERT, UPDATE, DELETE, and JOIN statements. Perfect for GCSE and National 5 revision, this resource provides clear examples and syntax to enhance your database query skills.

Computer ScienceComputer Science
S4

Object-Oriented Programming Essentials

Explore the fundamental concepts of Object-Oriented Programming (OOP) with this comprehensive guide. Covering key topics such as classes, objects, inheritance, encapsulation, polymorphism, and class diagrams, this resource is designed for AQA A-Level Computer Science students. Understand the principles of OOP and how to effectively apply them in programming.

Computer ScienceComputer Science
12

Programming Techniques Overview

Explore essential programming techniques including recursion, iteration, and modular programming. This summary covers key concepts such as algorithms, debugging, and data abstraction, providing a clear understanding of problem-solving methods in computer science. Ideal for OCR A-Level Computer Science students.

Computer ScienceComputer Science
13

Programming Constructs Overview

Explore essential programming constructs including loops, conditionals, and object-oriented principles. This summary covers key concepts such as recursion, encapsulation, inheritance, and the differences between local and global variables. Ideal for OCR A Level Computer Science students preparing for Component 2.2.

Computer ScienceComputer Science
12

Pseudocode Essentials

Explore key concepts of pseudocode including assignment statements, conditional statements, loops, and object-oriented programming. This summary covers essential programming constructs such as arrays, inheritance, and string handling, providing a comprehensive overview for students learning to write pseudocode effectively.

Computer ScienceComputer Science
12

Most popular content in Computer Science

Most popular content

Can't find what you're looking for? Explore other subjects.

Students love us — and so will you.

4.9/5

App Store

4.8/5

Google Play

The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.

Stefan S

iOS user

This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.

Samantha Klich

Android user

Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.

Anna

iOS user

Best app on earth! no words because it’s too good

Thomas R

iOS user

Just amazing. Let's me revise 10x better, this app is a quick 10/10. I highly recommend it to anyone. I can watch and search for notes. I can save them in the subject folder. I can revise it any time when I come back. If you haven't tried this app, you're really missing out.

Basil

Android user

This app has made me feel so much more confident in my exam prep, not only through boosting my own self confidence through the features that allow you to connect with others and feel less alone, but also through the way the app itself is centred around making you feel better. It is easy to navigate, fun to use, and helpful to anyone struggling in absolutely any way.

David K

iOS user

The app's just great! All I have to do is enter the topic in the search bar and I get the response real fast. I don't have to watch 10 YouTube videos to understand something, so I'm saving my time. Highly recommended!

Sudenaz Ocak

Android user

In school I was really bad at maths but thanks to the app, I am doing better now. I am so grateful that you made the app.

Greenlight Bonnie

Android user

very reliable app to help and grow your ideas of Maths, English and other related topics in your works. please use this app if your struggling in areas, this app is key for that. wish I'd of done a review before. and it's also free so don't worry about that.

Rohan U

Android user

I know a lot of apps use fake accounts to boost their reviews but this app deserves it all. Originally I was getting 4 in my English exams and this time I got a grade 7. I didn’t even know about this app three days until the exam and it has helped A LOT. Please actually trust me and use it as I’m sure you too will see developments.

Xander S

iOS user

THE QUIZES AND FLASHCARDS ARE SO USEFUL AND I LOVE THE SCHOOLGPT. IT ALSO IS LITREALLY LIKE CHATGPT BUT SMARTER!! HELPED ME WITH MY MASCARA PROBLEMS TOO!! AS WELL AS MY REAL SUBJECTS ! DUHHH 😍😁😲🤑💗✨🎀😮

Elisha

iOS user

This apps acc the goat. I find revision so boring but this app makes it so easy to organize it all and then you can ask the freeeee ai to test yourself so good and you can easily upload your own stuff. highly recommend as someone taking mocks now

Paul T

iOS user

The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.

Stefan S

iOS user

This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.

Samantha Klich

Android user

Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.

Anna

iOS user

Best app on earth! no words because it’s too good

Thomas R

iOS user

Just amazing. Let's me revise 10x better, this app is a quick 10/10. I highly recommend it to anyone. I can watch and search for notes. I can save them in the subject folder. I can revise it any time when I come back. If you haven't tried this app, you're really missing out.

Basil

Android user

This app has made me feel so much more confident in my exam prep, not only through boosting my own self confidence through the features that allow you to connect with others and feel less alone, but also through the way the app itself is centred around making you feel better. It is easy to navigate, fun to use, and helpful to anyone struggling in absolutely any way.

David K

iOS user

The app's just great! All I have to do is enter the topic in the search bar and I get the response real fast. I don't have to watch 10 YouTube videos to understand something, so I'm saving my time. Highly recommended!

Sudenaz Ocak

Android user

In school I was really bad at maths but thanks to the app, I am doing better now. I am so grateful that you made the app.

Greenlight Bonnie

Android user

very reliable app to help and grow your ideas of Maths, English and other related topics in your works. please use this app if your struggling in areas, this app is key for that. wish I'd of done a review before. and it's also free so don't worry about that.

Rohan U

Android user

I know a lot of apps use fake accounts to boost their reviews but this app deserves it all. Originally I was getting 4 in my English exams and this time I got a grade 7. I didn’t even know about this app three days until the exam and it has helped A LOT. Please actually trust me and use it as I’m sure you too will see developments.

Xander S

iOS user

THE QUIZES AND FLASHCARDS ARE SO USEFUL AND I LOVE THE SCHOOLGPT. IT ALSO IS LITREALLY LIKE CHATGPT BUT SMARTER!! HELPED ME WITH MY MASCARA PROBLEMS TOO!! AS WELL AS MY REAL SUBJECTS ! DUHHH 😍😁😲🤑💗✨🎀😮

Elisha

iOS user

This apps acc the goat. I find revision so boring but this app makes it so easy to organize it all and then you can ask the freeeee ai to test yourself so good and you can easily upload your own stuff. highly recommend as someone taking mocks now

Paul T

iOS user