Skip to content

Latest commit

 

History

History
67 lines (44 loc) · 3.39 KB

File metadata and controls

67 lines (44 loc) · 3.39 KB

Python Fundamentals Review

This document contains coding exercises and notes to reinforce core Python concepts from the Masterschool program. The content was developed through an interactive, conversational approach with an AI assistant (Gemini) to solidify my understanding.

Project Goals

  • Rapid Review: To quickly review and reinforce fundamental Python topics.
  • Personal Notes: To create a personal, organized set of notes and code examples for future reference.

Topics Covered

The exercises and code examples in this repository cover the following fundamental topics:

  • Data Types
  • Variables
  • Arithmetic Operators
  • Functions
  • Conditional Statements

This project serves as a practical study guide to help me keep my Python skills sharp.

🐍 1. Review of Key Concepts

Data Types and Variables

Data types are classifications of data that tell the computer what kind of data to expect and how to handle it. In Python, some common data types you've learned are:

  • Integers (int): Whole numbers, like 5, -10, 100.
  • Floats (float): Numbers with a decimal point, like 3.14, -0.5, 2.0.
  • Strings (str): Text enclosed in single or double quotes, like "Hello World", 'Python'.
  • Booleans (bool): Represents one of two values: True or False. They are often used in conditional statements.

Variables are used to store data values. Think of them as containers with labels. You assign a value to a variable using the equal sign (=).

image

Arithmetic Operators

Arithmetic operators are used to perform mathematical operations.

Operator Description Example Result
+ Addition 5 + 3 8
- Subtraction 10 - 4 6
* Multiplication 6 * 7 42
/ Division 15 / 2 7.5
// Floor Division 15 // 2 7
% Modulus (Remainder) 10 % 3 1
** Exponentiation 2 ** 3 8

Functions

Functions are reusable blocks of code that perform a specific task. They help make your code organized and easy to maintain. You can define a function using the def keyword, give it a name, and optionally include parameters to pass data into it. The return statement is used to send a value back from the function.

image

Conditions

Conditional statements allow your program to make decisions. They execute a block of code only if a certain condition is True. You use if, elif (else if), and else keywords.

  • The if block runs if the first condition is True.
  • The elif block is checked if the if condition is False.
  • The else block runs if all previous conditions are False.

You'll also use comparison operators to evaluate conditions, such as: == (equal to), != (not equal to), > (greater than), < (less than), >= (greater than or equal to), and <= (less than or equal to).

image

Python_Review of Key Concepts_Coding Exercises