Python Training Program Curriculum

Week 1: Introduction to Python-Complete Notes with Worked Examples and Exercises

Introduction to Programming Languages

Programming languages are tools that allow us to communicate with computers and instruct them to perform specific tasks. They can be broadly categorized into high-level languages, which are closer to human languages and abstract away complex details of computer operations (like Python, Java, and C++), and low-level languages, which are closer to machine code (like Assembly).

Why Python? - Overview of Python’s Strengths
Python is a high-level, interpreted language known for its simplicity and readability. Its strengths include:

Simplicity: Python's syntax is clear and intuitive, making it an excellent language for beginners.

Versatility: It's used in web development, data science, artificial intelligence, and more.

Extensive Libraries: Python has a vast standard library and third-party modules for nearly every task.

Developers Support: It has a large and active community of developers, providing a wealth of resources and guidance.

Setting up the Development Environment
To start coding in Python, you'll need to set up a development environment. This typically includes:

Python Installation: Download and install Python from the official website.

Code Editor: Choose a code editor or an Integrated Development Environment (IDE) like VSCode, PyCharm, or Jupyter Notebooks.

Package Manager: At advance level you will have to get familiar with pip for installing and managing Python packages.

ICT powers me in Python

ICT powers me is traditionally the first program you write when learning a new programming language. It's a simple way to introduce syntax and execution

print("ICT, powers me!")
for i in range(5):
print("Example " + str(i))
if x == 10:
print("x is ten")
Basic Examples in Python
# Example 1: Variables and Basic Arithmetic
a = 5
b = 10
print(a + b) # Outputs: 15
# Example 2: String Concatenation
first_name = "John"
last_name = "Bear"
print(first_name + " " + last_name) # Outputs: John Bear
# Example 3: User Input
name = input("Enter your name: ")
print("Good Day!, " + name) # Greets the user by name
# Example 4: Basic List Operations
numbers = [1, 2, 3, 4 5]
print(numbers[2]) # Outputs: 3
numbers.append(6) # Adds 6 to the list
print(numbers) # Outputs: [1, 2, 3, 4, 5, 6]
# Example 5: Simple Function
def greet():
print("Hello, World!")
greet() # Calls the greet function
Exercises Based on Variables and Basic Arithmetic

Exercise 1: Create two variables, x and y, assign numbers to them, and print their sum.

Exercise 2: Assign a number to a variable radius. Calculate and print the area of a circle using the formula π * radius^2. Use 3.14 for π.

Exercise 3:Create variables to store the height and width of a rectangle. Calculate and print the rectangle's perimeter.

Exercise 4: Assign any number to a variable number. Multiply number by 2 and then subtract 3. Print the result.

Exercise 5: Create two variables, price and quantity. Calculate and print the total cost (price * quantity).

Exercises Based on String Concatenation

Exercise 6: Create two variables, greeting and name, where name is obtained from user input. Concatenate and print a message using these variables.

Exercise 7: Create a variable day and assign a day of the week to it. Print a message saying, "Today is day", replacing day with the value of the variable.

Exercise 8: Concatenate three strings to form a complete sentence and print it. Ensure the sentence makes logical sense.

Exercises Based on User Input

Exercise 9: Ask the user for their favorite color and print a message saying, "Your favorite color is color", using the color they input.

Exercise 10: Write a program that asks the user for two numbers, adds them together, and prints the result. Make sure to convert the user inputs from strings to numbers before performing the addition.