BHARATI VIDYAPEETH RABINDRANATH TAGORE SCHOOL OF EXCELLENCE
ACADEMIC YEAR 2023-24
Name: _________________________ Grade: VII Div: ______ Date: ………………………
Subject: ICT Topic: Unit 7.1 : Block it out : Block-based to text-based
Python Notes
Sample Python Program
1. Accept a number from the user and display if it is a positive or a negative number.
n = float(input("Input a number: "))
if n >= 0:
if n == 0:
print("It is Zero!")
else:
print("Number is Positive number.")
else:
print("Number is Negative number.")
2. Write a Python program to print the following string in a specific format (see the output).
Sample String:
Twinkle, twinkle, little star,
How I wonder what you are!
Up above the world so high,
Like a diamond in the sky.
Twinkle, twinkle, little star,
How I wonder what you are
print("Twinkle, twinkle, little star, \n\tHow I wonder what you are! \n\t\tUp
above the world so high, \n\t\tLike a diamond in the sky. \nTwinkle, twinkle,
little star, \n\tHow I wonder what you are!")
Here, \n will bring the next text to new line. \t will leave indentation from the starting point.
3. Create a program to allow user for granting access to the system after they enter correct name.
Page | 1
4. Write a python program to create a Calculator which can perform 4 basic arithmetic operations.
5. Write a program to accept percentage from the user and display the grade according to the given
criteria.
Marks Grade
>90 A
>80 and <=90 B
>=60 and <=80 C
Below 60 D
6. Write a Python program to find the area and perimeter of rectangle.
7. Accept a number from the user and check if it is an odd or even number.
Page | 2
8. Accept the year of birth from the user and check if it is a leap year or not.
9. Create a python program to convert the temperature in degree centigrade to Fahrenheit.
10. Write a Python program to check from the age whether the person is senior citizen or not.
Page | 3