Python_Tutorials_Class_9
Python_Tutorials_Class_9
- What is Python?
Example:
print("Hello, World!")
- Understanding variables.
Example:
name = "Vedant"
age = 14
height = 5.6
is_student = True
print("Name:", name)
print("Age:", age)
print("Height:", height)
Example:
Example:
print("Grade: A")
print("Grade: B")
else:
print("Grade: C")
- Printing patterns.
Example:
print("*" * i)
Tutorial 6: Functions
Example:
def greet(name):
print("Hello", name)
greet("Vedant")
Example:
print(fruits[0])
fruits.append("orange")
print(fruits)
Tutorial 8: Dictionaries
- Key-value pairs.
Example:
print(student["name"])
student["age"] = 15
print(student)
Example:
import math
Example:
with open("my_file.txt", "w") as file:
file.write("Hello, Python!")
print(file.read())
Additional Practice:
1. Story Problems: Write a program to calculate the total marks and average of a student.
3. Math Problems: Develop programs to calculate the area of shapes or solve equations.