Introduction to Python Programming: Class Notes
Prof. Alice Brown
July 2025
1 Introduction
These notes cover the basics of Python programming for beginners, including variables, loops,
and functions. Ideal for students in introductory computer science courses.
2 Variables and Data Types
• Integers: Whole numbers, e.g., x = 5.
• Floats: Decimal numbers, e.g., y = 3.14.
• Strings: Text, e.g., name = "Alice".
x = 10
y = 2.5
name = " Python "
print ( name , x + y )
3 Loops
Loops allow repetitive tasks. A for loop iterates over a sequence:
for i in range (5) :
print ( i ) # Prints 0 to 4
A while loop runs until a condition is false:
count = 0
while count < 3:
print ( count )
count += 1
1
4 Functions
Functions encapsulate reusable code:
def greet ( name ) :
return f " Hello , ␣ { name }! "
print ( greet ( " Alice " ) )
5 Conclusion
Practice these concepts with small projects to build proficiency. Visit https://python.org
for more resources.