Brief Overview of Python
Brief Overview of Python
Exercise
Question 1:
Answer:
Question 2:
Write the corresponding Python assignment statements:
Answer:
Question 3:
Which data type will be used to represent the following data values and why?
a) Number of months in a year
b) Resident of Delhi or not
c) Mobile number
d) Pocket money
e) Volume of a sphere
f) Perimeter of a square
g) Name of the student
h) Address of the student
Question 4:
Answer:
Question 5:
Categorise the following as syntax error, logical error or runtime error:
a) 25 / 0
b) num1 = 25; num2 = 0; num1/num2
Answer:
Question 6:
Question 7:
Write a program to repeat the string ‘‘GOOD MORNING” n times. Here n is an
integer entered by the user.
Question 8:
Write a program to find the average of 3 numbers.
Question 9:
Write a program that asks the user to enter one's name and age. Print out a
message addressed to the user that tells the user the year in which he/she will
turn 100 years old.
Question 10:
What is the difference between else and elif construct of if statement?
Question 11: