Python Exercise
Python Exercise
Python Programming
Need to answers all questions. Do not copy from others. if anybody copied from
others will be awarded zero marks.
Write all the questions in an order
Theory questions:
1. List out all python features and its applications?
2. What is a variable and variable constant? Explain each with example?
3. Write steps how to write a python program?
4. What is a type-casting? How many types are there?
5. Define the following words:
a. comments
b. multiple assignments
c. indentation
d. statement
e. Escape sequence
6. List out operators available in python? Each with one example?
Programming problems:
1. Write a python program to calculate area of triangle using Herno’s formula:
PI=3.14
radius=float(input("Enter the radius of circle"))
area=PI*radius*radius
print (area)
4. Write a program to calculate the bill amount for an item given its quantity sold,
value, discount?
No of days = 1
No of hours = 24
No of minutes = 60
time_in_secs = (days * hours * minutes)*60
print("The number of seconds in a day is:", time_in_secs)
9. Write a program to calculate salary of an employee given his Basic pay (take user
input), HRA=10% and TA=5% of Basic pay. Then calculate the salary of employee?
basic_pay = float(input('Enter basic salary : '))
HRA = 0.1 * basic_pay
TA = 0.05 * basic_pay
salary = basic_pay + HRA + TA
print('Total Salary : %f' % salary)
10. Write a program to String concatenate and repetition?