Dash Ps 12
Dash Ps 12
OUTPUT
Enter a welcome message :Pythons welcomes youto it beautiful world .
Program 1
num1=int(input("Enter Number 1 : "))
num2=int(input("Enter Number 2 : "))
num3=int(input("Enter Number 3 : "))
sum=num1+num2+num3
print("Three Numbers are : ",num1,num2,num3)
print("Sum is : ",sum)
Enter Number 1 : 5
Output
Enter Number 2 : 4
Enter Number 3 : 3
Sum is : 12
Program 2
length=float(input("Enter the length of rectangle : "))
area=length*breadth
Output
Rectangle specifications
Program 3
to calculate BMI = kg/m square
BMI is : 25.78
Program 4
num=int(input("Enter a number :"))
cube= num*num*num
OUTPUT
Enter number : 7
Number is 7
PROGRAM
km=int(input("Enter kilometres: "))
miles=km0.621371
print("Kilometres:", km)
print("Miles:", miles)
OUTPUT
Enter kilometres: 20
Kilometres: 20
Miles: 12.42742
PROGRAM
tonnes float(input("Enter tonnes: "))
quintals tonnes * 10
print("Tonnes:", tonnes)
print("Quintals:", quintals)
print("Kilograms:", kgs)
OUTPUT
Enter tonnes: 2.5
Tonnes: 2.5
Quintles:25
Kilograms:2500
PROGRAM
num1 = input('Enter First Number: ')
num2 = input('Enter Second Number: ')
print("Value of num1 before swapping: ", num1)
print("Value of num2 before swapping: ", num2)
# swapping two numbers without using temporary variable
num1, num2 = num2, num1
print("Value of num1 after swapping: ", num1)
print("Value of num2 after swapping: ", num2)
OUTPUT
Enter First Number: 101
Enter Second Number: 99
Value of num1 before swapping: 101
Value of num2 before swapping: 99
Value of num1 after swapping: 99
Value of num2 after swapping: 101
PROGRAM
n1=int(input("Enter number 1 : "))
OUPUT
Enter number 1 : 4
Enter number 2 : 5
Enter number 3 : 6
Original Number : 4 5 6
After Swapping : 5 6 4
PROGRAM
poem input("Enter a small poem: ")
print (poem)
OUPUT
Enter a small poem: "Hope" is the thing with feathers- That perches in the soul sings the tune
without the words And never stops at all -EMILY DICKINSON
The poem you entered the words the thing with feathers- That perches in the soul- And sings the
tune wit And never stops at all EMILY DICKINSON