SUBMITTED TO: SUBMITTED BY:
POOJA GHAI MA’AM KARANVEER
SINGH
1. WAP TO INPUT AND PRINT A WELCOME MESSAGE
CODE:
s_p_1 = input(“ENTER YOUR WELCOME
MESSAGE HERE! ”)
print(s_P_1)
2. WAP to obtain the length and breadth of a
rectangle and calculate its area.
CODE:
length = int(input("ENTER THE LENGHT OF
RECTANGLE! "))
breadth = int(input("ENTER THE BREADTH OF
THE RECTANGLE HERE! "))
l_b = length*breadth
print(l_b)
3. Program to input marks in five subjects. Print total
marks and average.
CODE:
first=int(input("ENTER MARKS OF YOUR FIRST
SUBJECT "))
second=int(input("ENTER MARKS OF YOUR
SECOND SUBJECT "))
third=int(input("ENTER MARKS OF YOUR THIRD
SUBJECT "))
fourth=int(input("ENTER MARKS OF YOUR
FOURTH SUBJECT "))
fifth=int(input("ENTER MARKS OF YOUR FIFTH
SUBJECT "))
total_marks=(first+second
+third+fourth+fifth)
print("YOUR TOTAL MARKS ARE:", total_marks)
avg_marks = (total_marks/5)
print("YOUR AVERAGE MARKS ARE:",
avg_marks)
4. Program to print the cube of an input number.
CODE:
value = int(input("Enter a number: "))
cube = value ** 3
print("The cube of", value, "is:", cube)
5. Program to input a value in kilometres and convert it into miles
(1km=0.621371 miles)
CODE:
kilometer=int(input("ENTER VALUE IN KILOMETER!
"))
mile=0.621317
convert=(kilometer*mile)
print("ur input value in mile is:", convert)
6. WAP to enter two integers and perform all arithmetic operations
on them.
CODE:
num1 = int(input("Enter the first integer: "))
num2 = int(input("Enter the second integer: "))
addition = num1 + num2
subtraction = num1 - num2
multiplication = num1 * num2
division = num1 / num2
print("Results of Arithmetic Operations:")
print("Addition:", num1, "+", num2, "=", addition)
print("Subtraction:", num1, "-", num2, "=", subtraction)
print("Multiplication:", num1, "*", num2, "=",
multiplication)
print("Division:", num1, "/", num2, "=", division)
7. WAP to find the average of 3 input numbers.
CODE:
num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
num3 = int(input("Enter the third number: "))
average = (num1 + num2 + num3) / 3
print("The average of the three numbers is:", average)
8. WAP to Swap the values of two input numbers.
CODE:
num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
print("Before swapping:")
print("First number:", num1)
print("Second number:", num2)
num3 = num1
num1 = num2
num2 = num3
print("After swapping:")
print("First number:", num1)
print("Second number:", num2)
9. WAP to find the biggest of two input numbers.
CODE:
num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
if num1 > num2:
print(num1, "is the biggest number.")
elif num2 > num1:
print(num2, "is the biggest number.")
else:
print("Both numbers are equal.")
10. WAP to find the biggest of 3 input numbers.
CODE:
num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
num3 = int(input("Enter the third number: "))
if (num1 >= num2) and (num1 >= num3):
largest = num1
elif (num2 >= num1) and (num2 >= num3):
largest = num2
else:
largest = num3
print("The largest number is:", largest)