INDEX Page|2
Sr.No. Program Page No. Date Signature
1. Write a program to print “hello World” on the screen 3. 17/07/18
2. Write a program to print: 3. 17/08/18
Adding Fractions, get common denominators.
Multiply by missing factors to get the denominators.
Add numerators only, NOT denominators
3. Write a program that accepts radius of circle and prints its area. 3. 25/07/18
4. Write a program asks for height in centimetres and then converts your 3. 28/07/18
height to feet and inches
5. Write a program to read details like name, class, age of a student and 4. 28/07/18
then print the details firstly in same line and then separate lines.
(Make sure to have blank lines in these two different types prints)
6. Write a program to read three numbers in three variables and swap first 4. 28/07/18
two variables with the sums of first and second, second and third
numbers respectively.
7. Write a program to obtain principal amount, rate of interest and time 4. 28/27/18
from user and compute simple interest and compound interest.
8. Write a program to obtain temperature of 7 days and then display the 5. 7/08/18
average temperature of the week.
9. Write a program to reads a number of seconds and print it in form: 5. 7/08/18
mins and seconds.
Outputs
1.
2.
3.
4.
Program 1. Write a program to “Hello World” on the screen
Code :-
print("hello world")
Program 2. Write a program to print: Adding
Fractions, get common denominators. Multiply by
missing factors to get the denominators. Add
numerators only, NOT denominators
Code :-
print("Adding Fractions, get common denominators.")
print("Multiply by missing factors to get the denominators.")
print("Add numerators only, NOT denominators.")
Program 3. Write a program that accepts radius of circle and prints its area.
Code :-
radius=int(input("enter the radius of the circle"))
area=3.14*(radius**2)
print("the area of circle is",area)
Program 4. Write a program asks for height in centimeters and then converts your height to feet and
inches
Code :-
height=int(input("enter the height in centimeters"))
inches=height/2.5
feet=height/30
print("the length in inches",inches)
print("the length in feet",feet)
Outputs
5.
6.
7.
Program 5. Write a program to read details like name, class, age of a student and then print the details
firstly in same line and then separate lines. (Make sure to have blank lines in these two different types
prints)
Code :-
name=input("enter your name ")
Class=int(input("enter your class "))
age=int(input("enter your age "))
print("name = ",name,"class = ",Class,"age = ",age)
print("name = ",name)
print("class = ",Class)
print("age = ",age)
Program 6. Write a program to read three numbers in three variables and swap first two variables with
the sums of first and second, second and third numbers respectively.
Code :-
x=int(input("enter the 1st number"))
y=int(input("enter the 2nd number"))
z=int(input("enter the 3rd number"))
x=x+y
y=y+z
print (x,y,z)
Program 7. Write a program to obtain principal amount, rate of interest and time from user
and compute simple interest and compound interest.
Code :-
principal=int(input("enter the principal amount"))
rate=int(input("enter the rate of interest"))
time=int(input("enter the time period of interest in years"))
simpleinterest= (principal*time*rate)/100
compoundinterest = principal*(1+(rate/100))**time
print("simple interest is",simpleinterest) print("compound
interest is",compoundinterest)
Outputs
8.
9.
Program 8. Write a program to obtain temperature of 7 days and then display the average
temperature of the week.
Code :-
temp1=int(input("enter the temperature of sunday"))
temp2=int(input("enter the temperature of monday"))
temp3=int(input("enter the temperature of tuesday"))
temp4=int(input("enter the temperature of wednesday"))
temp5=int(input("enter the temperature of thursday"))
temp6=int(input("enter the temperature of friday"))
temp7=int(input("enter the temperature of saturday"))
average=(temp1+temp2+temp3+temp4+temp5+temp6+temp7)/7
print ("average temperature of the week is ",average)
Program 9. Write a program to reads a number of seconds and print it in form: mins and seconds.
Code:-
a=int(input("Enter the time in seconds in seconds "))
mins=int(a/60)
secs=a%60
print("The time in minutes and seconds is ", mins," Minutes ",secs," Seconds ")