Python for Data Science - Lesson 1: Basics
Slide 1: Welcome to Data Science
What is Data Science?
• Extracting knowledge from data
• Used in: health, finance, games, social media
Why Learn Python?
• Easy to understand
• Powerful tools for data
• Large community support
Slide 2: First Python Program
print("Hello, Data Science!")
• print() displays output
• This is how we start every Python journey
Slide 3: Variables & Data Types
name = "Abdulrahman" # string
age = 20 # integer
height = 1.75 # float
is_muslim = True # boolean
• Variables store information
• Types matter: string, int, float, bool
Slide 4: Taking User Input
username = input("Enter your name: ")
print("Welcome, " + username)
• input() gets data from the user
• Combine with print() for output
1
Slide 5: Conditions (If Statements)
age = int(input("Enter your age: "))
if age >= 18:
print("You are an adult.")
else:
print("You are still young.")
• Make decisions with if , elif , else
Slide 6: Loops
for i in range(5):
print("Lesson", i + 1)
• for loop repeats code
• range(5) runs 5 times (0 to 4)
Slide 7: Functions
def greet(name):
print("Hello", name)
greet("Abdulrahman")
• Functions let you reuse code
• Use def to define a function
Slide 8: Mini Task - Simple Calculator
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
operation = input("Choose operation (+, -, *, /): ")
if operation == "+":
print(num1 + num2)
elif operation == "-":
print(num1 - num2)
2
elif operation == "*":
print(num1 * num2)
elif operation == "/":
print(num1 / num2)
else:
print("Invalid operation")
Slide 9: Wrap Up
Today you learned:
• What Python is
• Variables, Input, Conditions, Loops
• How to write your first function
Next Class:
• Lists, Tuples, Dictionaries
• Student Score Tracker Project