0% found this document useful (0 votes)
6 views

Python_Tutorials_Class_9

this document is a practice sheet for class 9 students to practice the python codes as per class 9th syllabus

Uploaded by

VipinBaisla
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Python_Tutorials_Class_9

this document is a practice sheet for class 9 students to practice the python codes as per class 9th syllabus

Uploaded by

VipinBaisla
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Python Tutorials for Class 9 Students

Tutorial 1: Introduction to Python

- What is Python?

- Installing Python and an IDE (e.g., PyCharm, VSCode, or IDLE).

- Writing and running your first Python program: print("Hello, World!")

Example:

print("Hello, World!")

Tutorial 2: Variables and Data Types

- Understanding variables.

- Data types: Integer, Float, String, Boolean.

Example:

name = "Vedant"

age = 14

height = 5.6

is_student = True

print("Name:", name)

print("Age:", age)

print("Height:", height)

print("Is a student:", is_student)


Tutorial 3: Input and Output

- Taking input from users.

- Using input() and type conversion.

Example:

name = input("What is your name? ")

age = int(input("How old are you? "))

print("Hello", name, "! You are", age, "years old.")

Tutorial 4: Conditional Statements

- if, elif, and else.

- Writing simple decision-making programs.

Example:

marks = int(input("Enter your marks: "))

if marks >= 90:

print("Grade: A")

elif marks >= 75:

print("Grade: B")

else:

print("Grade: C")

Tutorial 5: Loops in Python

- Understanding for and while loops.

- Printing patterns.
Example:

for i in range(1, 6):

print("*" * i)

Tutorial 6: Functions

- Why use functions?

- Writing simple functions and using parameters.

Example:

def greet(name):

print("Hello", name)

greet("Vedant")

Tutorial 7: Lists and Tuples

- Understanding lists and tuples.

- Basic operations: Add, remove, and access elements.

Example:

fruits = ["apple", "banana", "cherry"]

print(fruits[0])

fruits.append("orange")

print(fruits)
Tutorial 8: Dictionaries

- Key-value pairs.

- Adding, updating, and retrieving values.

Example:

student = {"name": "Vedant", "class": 9, "age": 14}

print(student["name"])

student["age"] = 15

print(student)

Tutorial 9: Simple Math Programs

- Writing programs to solve math problems (fits your curriculum).

- Example: Finding the HCF and LCM.

Example:

import math

a = int(input("Enter first number: "))

b = int(input("Enter second number: "))

print("HCF:", math.gcd(a, b))

Tutorial 10: Basic File Handling

- Reading from and writing to files.

Example:
with open("my_file.txt", "w") as file:

file.write("Hello, Python!")

with open("my_file.txt", "r") as file:

print(file.read())

Additional Practice:

1. Story Problems: Write a program to calculate the total marks and average of a student.

2. Pattern Printing: Create patterns like pyramids using loops.

3. Math Problems: Develop programs to calculate the area of shapes or solve equations.

You might also like