Python Lab Printouts - Copy
Python Lab Printouts - Copy
OUTPUT:
OUTPUT:
Enter the first digit : 534
Enter the second digit : 32
The sum of the given two digits is 566
The substraction of the given two digits is 502
The multiplication of the given two digits is 17088
The division of the given two digits is 16.69
The integer division of the given two digits is 16
The modular divion of the given two digits is 22
EXPERIMENT : 3
AIM : Write a program to convert a floating point number to
corresponding integer.
CODE :
b=float(input("Enter a number:"))
print("The integer value of "+str(b)+"="+str(int(b)))
OUTPUT:
Enter a number:17.87
The integer value of 17.87=17
EXPERIMENT : 4
AIM : Write a program to convert a integer number to
corresponding floating point number.
CODE:
n=int (input("Enter a number:"))
print("The floating number is : "+ str(float(n)))
OUTPUT:
Enter a number:12
The floating number is : 12.0
EXPERIMENT : 5
AIM: Write a program that demonstrates the relationship
operator
CODE:
a=int(input("Input 1st number :"))
b=int(input("Input 2nd number :"))
print("a==b",a==b)
print("a!=b",a!=b)
print("a<b",a<b)
print("a<=b",a<=b)
print("a>b",a>b)
print("a>=b",a>=b)
OUTPUT:
Input 1st number :51
Input 2nd number :98
a==b False
a!=b True
a<b True
a<=b True
a>b False
a>=b False
EXPERIMENT : 6
AIM : Write a program to enter a number and display it's hex
and octal equivalent and it's square root.
CODE :
number = int(input("Enter a number: "))
hexadecimal = hex(number)
octal = oct(number)
square_root = (number)**0.5
OUTPUT:
Enter a number: 56
The hexadecimal equivalent of 56 is 0x38
The octal equivalent of 56 is 0o70
The square root of 56 is 7.48