Professional Documents
Culture Documents
Class VII Python Programs
Class VII Python Programs
Ans a=10
b=20
c=a+b
print("The sum of two numbers is ",c)
Q. 4 Write a Python program to ask the user's name and greet him 'Good Morning'.
Ans name=input("Enter your name:")
print("Good Morning ",name)
Q. 6 Write a Python program to check whether a person can vote in the election or
not.[age>=18 can vote]
Ans age=int(input("Enter your age "))
if age>=18:
print("You can vote!")
else:
print("You cannot vote!")
Q. 10 Write a Python program to print the sum of 10 numbers entered by the user.
Ans sum=0
for i in range(1, 11, 1):
n1=int(input("Enter any number "))
sum=sum+n1
print("Sum of 10 numbers ", sum)
Q. 11 Write a Python program to print all the even numbers in the range entered by
the user.
Ans lower_limit = int(input("Enter your lower limit "))
upper_limit = int(input("Enter your upper limit "))
for i in range(lower_limit, upper_limit+1, 1):
if i%2==0:
print(i)
Q. 12 Write a Python program to print all the odd numbers in the range entered by
the user.
Ans lower_limit = int(input("Enter your lower limit "))
upper_limit = int(input("Enter your upper limit "))
for i in range(lower_limit, upper_limit+1, 1):
if i%2!=0:
print(i)
Q. 13 Write an HTML code to create a web page with the following functionalities.
Use of CSS is expected:
1. The background colour of the page should be orange and the text colour
should be brown.
2. The page should have a table with three rows and three columns filled with
the data of your choice.
3. The border of the table should be of blue colour.
4. The page should have an ordered list of names of any five festivals.
5. The page should have an unordered list of the names of five states of
India.
Ans <HTML>
<HEAD><TITLE>Good Morning to All</TITLE>
<STYLE TYPE="TEXT/CSS">
body{background-color:orange;color:brown}
table,td,th{ border:5px solid blue}
</STYLE>
</HEAD>
<BODY>
<TABLE>
<CAPTION>MY TIMETABLE</CAPTION>
<TR> <TH>NAME</TH> <TH>CLASS</TH> <TH>AGE</TH> </TR>
<TR> <TD>RAVI</TD> <TD>VII</TD> <TD>12</TD> </TR>
<TR> <TD>AVI</TD> <TD>VI</TD> <TD>10</TD> </TR>
<TR> <TD>KAVI</TD> <TD>VIII</TD> <TD>14</TD> </TR>
</TABLE>
<OL>
<LI>HOLI</LI>
<LI>DIWALI</LI>
<LI>DUSSEHRA</HI>
<LI>RAKSHABANDHAN</LI>
<LI>MAKAR SAKRANTI</LI>
</OL>
<UL>
<LI>MADHYA PRADESH</LI>
<LI>UTTER PRADESH</LI>
<LI>MAHARASHTRA</HI>
<LI>HARYANA</LI>
<LI>KERALA</LI>
</UL>
</BODY>
</HTML>