0% found this document useful (0 votes)
137 views

R19 Python Lab Manual

The document contains 3 programming problems and their solutions: 1) A program to convert kilograms to pounds by multiplying the user input weight in kg by 2.2. 2) A program that asks the user to input 3 numbers, calculates their sum and average, and prints the total and average. 3) A program that uses a for loop to print the numbers from 8 to 89 incrementing by 3 each time.

Uploaded by

jayasree
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views

R19 Python Lab Manual

The document contains 3 programming problems and their solutions: 1) A program to convert kilograms to pounds by multiplying the user input weight in kg by 2.2. 2) A program that asks the user to input 3 numbers, calculates their sum and average, and prints the total and average. 3) A program that uses a for loop to print the numbers from 8 to 89 incrementing by 3 each time.

Uploaded by

jayasree
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Write a program that asks the user for a weight in kilograms and converts
it to pounds. There are 2.2 pounds in a kilogram.
Program :

kilo = float(input("Enter weight in kilograms"))

pounds = 2.2 * kilo

print("weight in pounds",pounds)

Output :
2.Write a program that asks the user to enter three numbers (use three
separate input statements). Create variables called total and average that hold
the sum and average of the three numbers and print out the values of total
and average.

Program:

n1=int(input("Enter first number"))

n2=int(input("Enter first number"))

n3=int(input("Enter first number"))

total=n1+n2+n3

average=(total)/3

print("Total={},Average={}".format(total,average))

Output:
3. Write a program that uses a for loop to print the numbers 8, 11, 14, 17, 20, . . . ,
83, 86, 89.

Program :

for i in range(8,90,3):

print(i,end="\t")

Output:

You might also like