0% found this document useful (0 votes)
43 views5 pages

Python Programs

The document outlines various Python programming exercises for Grade 9 students at Sharjah Indian School Juwaiza. Activities include printing personal information, creating patterns, implementing a simple calculator, and performing basic arithmetic operations. The document also includes user input tasks for reading and displaying names and addresses.

Uploaded by

rreji6279
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views5 pages

Python Programs

The document outlines various Python programming exercises for Grade 9 students at Sharjah Indian School Juwaiza. Activities include printing personal information, creating patterns, implementing a simple calculator, and performing basic arithmetic operations. The document also includes user input tasks for reading and displaying names and addresses.

Uploaded by

rreji6279
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SHARJAH INDIAN SCHOOL JUWAIZA

GRADE 9 WE LAB ACTIVITIES

1. Write a Python program to print your name.


Program
print(“Name”) //Enter your name
Output
Name
2. Write a Python program to print your address.
Program
print(“Building name \nStreet \nArea \nEmirate”) //Enter your proper address
Output
Building name
Street
Area
Emirate
3. Write a Python program to print the following pattern
*
* *
* * *
Program
print(“* \n*\t*\n*\t*\t*”)
Output
*
* *
* * *
4. List your favorite sports games. (Use ‘,’ as a separator and ‘………..’ at the end)

Program
print(“cricket”, “football”, “badminton” ,“hockey”, sep=”,” , end=”……….”)

Output

cricket,football, badminton ,hockey……….

5. Write a Python program to print the following pattern(HW)

2 2

3 3 3

Program
print(“\t \t 1\n\t 2\t2\n3\t3\t3”)
Output
1

2 2
3 3 3
6. List 7 Emirates in the UAE. (Use ‘--’ as a separator and ‘!!!!!!’ at the end)(HW)

Program
print(“Abu Dhabi”, “Dubai”, “Sharjah”,“Ajman”,“Umm Al Quwain” ,“Fujairah”, “Ras Al
Khaimah”, sep=”--” , end=”!!!!!!”)
Output

Abu Dhabi--Dubai--Sharjah--Ajman--Umm Al Quwain--Fujairah--Ras Al Khaimah!!!!!!

7. Write a program to implement a simple calculator.

Program

a=200
b=100
sum=a+b
difference=a-b
product=a*b
division=a/b
modulus=a%b
print(“Sum=”,sum)
print(“Difference =”, difference)
print(“Product =”, product)
print(“Division =”, division)
print(“Remainder =”, modulus)

Output

Sum = 300

Difference = 100

Product = 20000
Division = 2.0

Remainder = 0

8. Write the output of the following comparison operators.

Program

a=100

b=200

c=300
d=200

print(a<b)

print(a>b)
print(b<=d)
print(b>=d)

print(c<=a)

print(c==d)

print(b==d)

print(c!=a)

print(d!=b)

Output
True

False

True

True

False

False

True
True

False

9. Write a Python program to read a name, Gr no and school name from the user side and print
those details.

name = input("Enter your name: ")

gr_no = int(input("Enter your GR number: "))

school_name = input("Enter your school name: ")

print("\n--- User Details ---")

print("Name:", name)

print("GR Number:", gr_no)


print("School Name:", school_name)

Output

Enter your name: <Write your name>

Enter your GR number: <Write your GR Number>

Enter your school name: <Write your school name >

--- User Details ---


Name: <Write your name>
GR number: <Write your GR Number>

School Name: <Write your school name >

10. Write a Python program to read a name and address from the user side and print those
details.

name = input("Enter your name: ")

building_name = input("Enter building name: ")

street_name = input("Enter street name: ")

area = input("Enter area: ")


emirate = input("Enter emirate: ")

print("\n--- User Details ---")

print("Name:", name)

print("Address:")

print("Building Name:", building_name)

print("Street Name:", street_name)

print("Area:", area)

print("Emirate:", emirate)
Output

Enter your name: <Write your name>

Enter building name: <Write your building name >

Enter street name: <Write your street name >

Enter area: <Write your area >

Enter emirate:<Write your emirate >

--- User Details ---


Name: <Write your name>

Address

Building Name: <Write your building name >

Street Name: <Write your street name >

Area: <Write your area >

Emirate:<Write your emirate >


11. Write a program to find the sum of two integer numbers. [Read numbers from the user side]
Program

num1 = int(input("Enter the first integer: "))

num2 = int(input("Enter the second integer: "))

sum = num1 + num2

print("The sum of", num1, "and", num2, "is:", sum)

Output

Enter the first integer:10


Enter the second integer:30

The sum of 10 and 30 is 40

12. Write a program to find the product of 3 floating point numbers. [Read numbers from the
user side]

Program

num1 = float(input("Enter the first floating-point number: "))

num2 = float(input("Enter the second floating-point number: "))

num3 = float(input("Enter the third floating-point number: "))

product = num1 * num2 * num3

print("The product of", num1, ",", num2, "and", num3, "is:", product)
Result

Enter the first floating-point number: 10.5

Enter the second floating-point number:20.6

Enter the third floating-point number: 40.9

The product of 10.5, 20.6 and 40.9 is 8846.67

You might also like