Experiment 4 Program
Experiment 4 Program
def decimal_into_binary(decimal_1):
decimal = int(decimal_1)
print ("The given decimal number", decimal, "in Binary number is: ", bin(decimal))
def decimal_into_octal(decimal_1):
decimal = int(decimal_1)
print ("The given decimal number", decimal, "in Octal number is: ", oct(decimal))
def decimal_into_hexadecimal(decimal_1):
decimal = int(decimal_1)
print ("The given decimal number", decimal, " in Hexadecimal number is: ", hex(decimal))
# Driver program
decimal_into_binary(decimal_1)
decimal_into_octal(decimal_1)
decimal_into_hexadecimal(decimal_1)
Output:
>
import calendar
print(calendar.month(yy,mm))
Output :
Enter month: 2
February 2024
Mo Tu We Th Fr Sa Su
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29
return P + Q
def subtract(P, Q):
return P - Q
return P * Q
return P / Q
if choice == 'a':
Output:
1. Addition:
a. Add
b. Subtract
c. Multiply
d. Divide
2 + 2 = 4
2. Subtraction:
3. Multiplication:
return;
printinfo( name="Rohan" )
Output:
This prints a passed info into this function
Name: Riya
Age 25
Name: Rohan
Age 35
Name: Pranoti
Age 41
>
Program 5 : Keywords Arguments
return;
#printinfo("Raghav",5)
printinfo(5,"Raghav")
Output:
This prints a passed info into this function
Name: 5
Age Raghav
Name: Riya
Age 25
>
>
return total;
sum( 10, 20 );
total=sum( 20, 20 )
Output:
Inside the function local total : 30
>
for i in argv:
Output:
First argument : Hello
>