Python provides input() and print() to take input and display output into the program.
Python provides a predefined function to take input from the keyboard and display output into the monitor.
1) input():-It is used to take input from the keyboard using a String pattern (a combination of char), we can pass the display message as a parameter into input(). that is used to reduce the extra code as compared to C and CPP programming language.
var = input("message") #var is the variable name which will assign input data into string pattern
we can convert input data into other datatype such as int, float using the type conversion method.
to convert into an integer then it provides int(), to convert into float it provides float().
input() takes one parameter to display the message in a String format and it also returns data into String form.
var = input("message")
Example of input() to take input for integer data
a = int(input("Enter number"))
Example of input() to take input for float data
b = float(input("Enter float value"))
Example of input() to take input for String data
c = input("Eter string value"))
int():- It is used to convert numeric String type data or float type data to an integer.
Syntax:-
var = int(input("message")) #it will take integer type input
int() is used to convert numeric string type data to the integer type.
Float():- float() is used to convert numeric string type data to float type.
Syntax:-
var = float(input("message")) #it will take input for float type
Str():- It is used to convert integer type data to String type, but no need to use it under input() because of the Input method linked with str() by default.
2) print():-
It is used to display output data using a single statement and multiple statements.
this method can accept the single parameter and multiple parameters both.
for multiple parameters, we will use a comma separator.
print("hello")
print("hello",12,"hi","welcome")
...................................................................
print() using format specifier
a=12.345
b=23.56
print("a=%d and b=%d " % 100,200) %d int, %f float, %s string
print() using comma separator
print(statement1, statement2)
print() using format() to print multiple statements under Single Statement.
print("a={0} and b={1}".format(a,b)) # it uses placeholder
print() to write an expression
print() using String concatenation.
note:- all variables or literals or constant must be String for String Concatenation.
print("a="+str(a))
print("a="+str(a) + "b="+str(b))
print("statement1") #Single Statement
print("statement1","statement2") #Multiple Statements
print("statement1"+"statement2") #Concatenation with two Strings
print("statement1" + str(10)) #str() is used to convert int ,float to String
print("result is ",12.3444567891) #print float value
print("result is %.2f" % 12.3444567891) #print formatted float value
print("{0},{1}".format(2,3)) # {0} and {1} is called placeholder in print()
A basic example of str() in:-
s="hello"
y=10
print(s+str(y))
a=10
b=20.34
print(a+b)
Another example to uses multiple print
a=12.345
b=23.56
print("a=%d and b=%d " % (a,b))
print("a=%f and b=%f" % (a,b))
print("a=%.2f and b=%.2f" % (a,b))
print("a=",a,"b=",b)
print(a,b)
print("a={0} and b={1}".format(a,b)) # it uses placeholder
print(a+b)
print(a+b,a*b,a/b,a%b)
print("a="+str(a) + " b= "+str(b)) #str() to convert int,float to String
Program assignment:-
#Programm for calculate the salary of the employee where basic, ta, da, comm, pf, noofleave will be entered by the user.
ردحذف'''Get Basic Salary of Employee,
DA = 25% of Basic,
HRA = 15% of Basic,
PF = 12% of Basic,
TA = 7.50% of Basic,
Net Pay = Basic + DA + HRA + TA,
Gross Pay = Net Pay - PF. '''
name=str(input("Enter the name of employee: "))
basic=float(input("Enter the basic salary: "))
da=float(basic*25)/100
hra=float(basic*15)/100
pf=float(basic*12)/100
ta=float(basic*7.50)/100
netpay=float(basic+da+hra+ta)
grosspay=float(netpay-pf)
print("\n\n")
print("Salary Detail")
print("\n")
print(" NAME OF EMPLOYEE : ",name)
print(" BASIC SALARY : ",basic)
print(" DEARNESS ALLOW. : ",da)
print(" HOUSE RENT ALLOW.: ",hra)
print(" TRAVEL ALLOW. : ",ta)
print("\n")
print(" NET SALARY PAY : ",netpay)
print(" PROVIDENT FUND : ",pf)
print(" GROSS PAYMENT : ",grosspay)
#reverse the five-digit number where first and last digit will be in the same position
ردحذف#Reverse Program Answer?
num=12345
print("Actual number is",num)
a=num%10 #5
num=num//10 #1234
b=num%10 #4
num=num//10 #123
c=num%10 #3
num=num//10 #12
d=num%10 #2
e=num//10 #1
num1= e*10000+b*1000+c*100+d*10+a*1
print("Reverse of number is",num1)
#complex number with a complex number
ردحذفnum1 = 2+3j
num2 = 4+5j
num = num1+num2
print(num1)
print(num2)
print(num)
Please help me how can use j, If I am using another character that getting error
حذف#program to calculate compound interest
ردحذف#formula : p * (pow((1 + r / 100), t))
p=float(input("Enter the principal amount :"))
t=float(input("Enter the number of year :"))
r=float(input("Enter the rate of intrest :"))
#compund interest
ci=p*(pow((1+r/100),t))
print("Compound Interest %.2f" % ci)
#Program to calculate simple interest
ردحذفp,r,t=12000,2.2,3.5
si=(p*r*t)/100
print("result is p={0} , r={1} , t={2} ,si={3} ".format(p,r,t,si))
#print("result is %.2f" % si)
# Python program to calculate square of a number and cube of a number
ردحذف# Method 3 (using math.pow () method)
# importing math library
import math
# input a number
number = int (input ("Enter an integer number: "))
# calculate square
square = int(math.pow (number, 2))
cube = int (math.pow (number, 3))
# print
print ("Square of {0} is {1} ".format (number, square))
print ("Cube of {0} is {1} ".format (number, cube))
#swap two numbers without using third variable
ردحذفx=int(input("Enter the value of X : "))
y=int(input("Enter the value of Y : "))
print ("Before swapping: ")
print("Value of X : ", x, " and Y : ", y)
# code to swap 'x' and 'y'
x, y = y, x
print ("After swapping: ")
print("Value of x : ", x, " and y : ", y)
#convert temperature from Celsius to Fahrenheit?
ردحذف# formula --> fahrenheit = (celsius * 1.8) + 32
celsius=float(input(" Temperature in Celsius : "))
fahrenheit=(celsius*1.8)+32
print("{0} degree Celsius is equal to {1} degree Fahrenheit".format (celsius,fahrenheit))
##perform multiplication of a complex number using complex datatype?
ردحذفnum1=complex(input('Enter first complex number: '))
num2=complex(input('Enter second complex number: '))
cal=num1*num2
print('"Multiplication of complex number is "', cal)
#print data in the single quote and double quote
ردحذفprint("\nPrint with double quote")
print ('"Welcome in SCS"')
print("\nPrint with single quote")
print ("'Welcome in Python'")
basic = float(input("enter basic"))
ردحذفta = float(input("enter ta"))
da = float(input("enter da"))
comm = float(input("enter commision"))
pf = float(input("enter pf "))
nl = float(input("enter number of leave"))
tsal = basic+ta+da+comm
deduction = ((tsal)/30) *nl
gsal = tsal-deduction-pf
print("CTC",tsal)
print("Gross salary",gsal)
print("Total pf ",pf," Leave deduction is ",nl)
#1a=[1,2,3,4,5]
ردحذف#1print(a[::-1])
#2num1=2+3j
#2num2=3+4j
#2num=num1+num2
#2print(num)
##num2=5+4j
#a=2+5
#b=(3+4)
#a=12345%10
#num=12345//10
#b=1234%10
#num=1234//10
#c=123%10
#num=123//10
#d=12%10
#num=12//10
#e=1
#num=a*10000+b*1000+c*100+d*10+e
#print(num)
#num=12345
Program to reverse the five-digit number where the first and last digit remains in same position--->
ردحذفnum=12345
a=num%10
num=num//10
b=num%10
num=num//10
c=num%10
num=num//10
d=num%10
e=num//10
rev=a*1+d*10+c*100+b*1000+e*10000
print("rev of a number",rev)
Program to calculate square and cube of any entered number-->
ردحذفa=input("enter the value of a")
square=int(a)*int(a)
print("square of a=",square)
cube=int(a)*int(a)*int(a)
print(cube of a=",cube)
WAP to calculate the salary of the employee where basic, ta, da, comm, pf, noofleave will be entered by the user?WAP to calculate the salary of the employee where basic, ta, da, comm, pf, noofleave will be entered by the user?
ردحذفname=str("enter the employee name")
basic=float(input("enter salary"))
da=float(basic*10)/100
hra=float(basic*25)
pf=float(basic*5)
ta=float(basic*6.5)
netpay=float(basic+da+hra+ta)
grosspay=float(netpay-pf)
print("\n\n")
print("name of employee",name)
print("basic salary",basic)
print("dear allowness",da)
print("hra",hra)
print("provident fund",pf)
print("travell allowness",ta)
print("\n")
print("netpay",netpay)
print("providentfund",pf)
print("gross salary",grosspay)
wap to calculate simple intrest
ردحذفp=int(input("enter principal"))
r=float(input("enter rate"))
t=int(input("enter time"))
si=float(p*r*t)/100
print("simple interst",si)
wap to revesre 5-digit number where 1st and last digit will be on same position
ردحذفnum=int(input("enter 5-digit number")
a=num%10
num=num//10
b=num%10
num=num//10
c=num%10
num=num//10
d=num%10
e=num//10
num1=e*10000+d*1000+c*100+b*10+a*1
print(nim1)
wap square and cube of a number
ردحذفa=int(input("value of a"))
square=int(a*a)
print(square)
b=int(input("value of b"))
cube=int(b*b*b)
print(b)
wap to swap two number without using third variable
ردحذفa=int(input("value of a"))
b=int(input("value of b"))
print("before swap")
a,b=b,a
print("after swap")
print("a=",a,"b=",b)
p=25000
ردحذفR=2
t=2
n=12
r =R/100
A = p*((1+(r/n))**(n*t))
print(A)
Program to calculate compound interest-->
ردحذفp=int(input("enter the value of p"))
R=int(input("enter the value of R"))
t=int(input("enter the value of t"))
n=int(input("enter the value of n"))
r=R/100
ci=p*((1+(r/n))**(n*t)-1)
print(ci)
Programm to calculate the salary/ta/da/deduction of the employee where basic salary, no of leave will be entered by the user.
ردحذفname=str(input("enter name of employee"))
basic = float(input("enter basic salary"))
ta = float(basic*5)//100
da = float(basic*6)//100
comm = float(basic*3)//100
pf = float(basic*12)//100
nl = float(input("enter number of leave"))
sal = basic+ta+da+comm
deduct = ((sal)//30) *nl
gsal = sal-deduct-pf
print("CTC",sal)
print("Gross salary",gsal)
print("Total pf ",pf," Leave deduction= ",deduct)
# PYTHON (6 to 7 PM BATCH)
ردحذف#Program for swaping two numbers without using a third variable
a = int(input("Enter The Value for A :\t"))
b = int(input("Enter The Value for B :\t"))
print("Value of A:\t",a,":\n""Value of B:\t",b)
print("After swaping two numbers:\tA={0}\tB={1}".format(b,a))
PARAG JAISWAL
ردحذف"""WAP to calculate the salary of the employee where basic, ta, da, comm, pf, noofleave will be entered by the user?"""
basic_salary = int(input("Enter your basic salary = "))
ta = int(input("Enter your ta = "))
da = int(input("Enter your da = "))
comm = int(input("Enter your comm = "))
pf = int(input("Enter your pf amount = "))
no_of_leave = int(input("Enter your no. leave = "))
leave_amount = no_of_leave * ((basic_salary + ta + da +comm +pf)/30)
net_salary =basic_salary + ta + da + comm + pf - leave_amount
print("Your net salary = ",net_salary)
Parag Jaiswal
ردحذف#WAP to calculate compound interest?
p = int(input("Enter principal amount = "))
r = int(input("Enter rate of interest = "))
t = int(input("Enter time period = "))
total_value = p * ((1 + (r/100)) ** t)
print("Total Amount = %.2f"%total_value)
print("Compund Interest = %.2f"% (total_value - p))
Parag Jaiswal
ردحذف#WAP to reverse the five-digit number where the first and last digit will be in the same position
num =12345
e =num % 10 #1
num = num // 10 # 5432
b = num % 10 #2
num = num // 10 #543
c = num % 10 #3
num = num // 10 #54
d = num % 10 # 4
a = num //10 # 5
rev = a * 10000 + b * 1000 + c * 100 + d * 10 + e * 1
print (rev)
Parag Jaiswal
ردحذف3WAP to swap two numbers without using a third variable
a = 5
b =9
a,b=b,a
print(a,b)
Parag Jaiswal
ردحذف#WAP to calculate square and cube of any entered number?
num =int(input("Enter number = "))
square = pow(num , 2)
cube = num ** 3
print("Square and cube of ", num, "is", square ,"&",cube)
Adarsh dixit
ردحذف'''WAP to calculate the total salary of an employee where basic, ta, da, comm, pf,hra, leave will be entered by the users?'''
basic_salary = int(input("enter ur basic salary: "))
ta = int(input("enter ur ta: "))
da = int(input("enter ur da: "))
comm = int(input("enter ur comm: "))
pf = int(input("enter ur pf amount: "))
num_of_leave = int(input("enter ur num of leave: "))
leave_amount = num_of_leave*((basic_salary+ta+da+comm+pf)/30)
net_salary =basic_salary + ta + da + comm + pf - leave_amount
print("ur net salary=",net_salary)
Adarsh dixit
ردحذف#WAP to swap two numbers without using a third variable
a = 5
b = 6
print("before swaping: ")
print("value of a : ",a,"value of b : ",b)
a,b = b,a
print("after swaping")
print("value of a : ",a,"value of b : ",b)
To calculate compound interest:-
ردحذف(p,r,n,t)=(12000,4.3,3,2)
print(p)
print(r)
print(n)
print(t)
A=p*(1+(r/n))**(n*t)
print(A)
reversed the five-digit number where the first and last digit will be in the same position:-
ردحذفx=12345
print("Given Number:", x)
a=x%10
x=x//10
b=x%10
x=x//10
c=x%10
x=x//10
d=x%10
e=x//10
y=e*10000+b*1000+c*100+d*10+a*1
print("Reverse of the middle part of the given number:", y)
#MOhit Chouhan
ردحذف1.
empsal=int(input("Enter the salary : " ))
ta=int(input("Enter the TA : " ))
da=int(input("Enter the DA : " ))
comm=int(input("Enter the comm : " ))
pf=int(input("Enter the pf : "))
lea=int(input("Enter the leave : "))
total=(empsal+ta+da+comm-pf)
print("salary before leave : ", total)
b=empsal/30
w=b*lea
final=(total-w)
print("Final salary : ", final)
2.
p=int(input("Enter the principal:"))
r=int(input("Enter the Rate: "))
t=int(input("Enter the Time : "))
ci= (p*(1+(r/100))**t)
print("your compunt intrest is : " ,ci-p)
3.
a=int(input("Enter the five digit number : ")) #12345
r=a%10 #5
b=a//10 #1234
s=b%10 #4
c=b//10 #123
t=c%10 #3
d=c//10 #12
u=d%10 #2
e=d//10 #1
print((str(e)+str(s)+str(t)+str(u)+str(r)))
4.
a=int(input("Enter the 1st Value plz: "))
b=int(input("Enter the 2nd Value plz : "))
print("Before swapping : ", a ,b )
a,b=b,a
print("after swapping : ", a ,b)
5.
a=int(input("Enter the value : "))
v= a*a
print("The Squre of your value is : ", v)
w= a*a*a
print("The cube of your value is : ", w)
# WAP to calculate the total salary of an employee where basic, ta, da, comm, pf,hra, leave will be entered by the users?
ردحذف'''basic:- 12000
ta= 400
da=200
comm=500
pf =-500
hra = 300
leave=3'''
ta=int(input("enter ta : "))
da=int(input("enter da : "))
comm=int(input("enter comm : "))
pf=int(input("enter pf : "))
hra=int(input("enter hra : "))
sal=int(input("enter basic salary : "))
lve=int(input("enter leave's : "))
c=(ta+da+comm+hra-pf)
onedy=sal/30
tslry=((30-lve)*onedy)
final=tslry+c;
print("actual salary=",final)
#WAP to calculate compound interest?
ردحذفp=int(input("put p : "))
r=float(input("put r : "))
t=float(input("put t : "))
ci=p*(pow((1+r/100),t));
print("%.2f"%ci)
n=int(input("Enter the 5'digites number : "))
ردحذفa=n%10 #5
n=n//10 #1234
b=n%10 #4
n=n//10 #123
c=n%10 #3
n=n//10 #12
d=n%10 #2
n=n//10 #1
e=n%10 #1
n=n//10 #0
z=( ( ( ( ( ( ( (e*10)+b)*10)+c)*10)+d)*10)+a)
print(z)
# WAP to swap two numbers without using a third variable (two ways foe without using third variable in python)
ردحذف'''a,b=int(input("a:")),int(input("b:"))
a,b=b,a
print("a:",a,"b:",b)'''
a,b=int(input("a:")),int(input("b:"))
a=a+b
b=a-b
a=a-b
print("a:",a,"b:",b)
# WAP to swap two numbers without using a third variable (two ways foe without using third variable in python)
ردحذف'''a,b=int(input("a:")),int(input("b:"))
a,b=b,a
print("a:",a,"b:",b)'''
a,b=int(input("a:")),int(input("b:"))
a=a+b
b=a-b
a=a-b
print("a:",a,"b:",b)
#WAP to calculate square and cube of any entered number?
ردحذفno=int(input("Enter a number : "))
square=
cube=no*no*no
square=pow(no,2) # no*no;
cube=pow(no,3) # no*no*no; square*no;
print("Square is",square)
print("Cube is",cube)
WAP to reverse a five-digit number without using a loop?
ردحذفnum=12345
print(num)
a=num%10
num=num//10
b=num%10
num=num//10
c=num%10
num=num//10
d=num%10
e=num//10
num1=a*10000+b*1000+c*100+d*10+e*1
print(num1)
Salary Calculation
ردحذفba= int(input("Enter basic salary"))
ta= int(input("enter ta"))
da= int(input("enter da"))
com= int(input("enter com"))
pf= int(input("input pf"))
nl= int(input("input nl"))
sal= ba-ta+da+com-pf+nl
print("your salary is", sal)
compound interest
ردحذفp=100000
r=5
n=100
nt=4
a=p*((1+(r/n))**nt)
print(a)
ci= a-p
print(ci)
swap two digit no.
ردحذفx= int(input("enter value x"))
y= int(input("enter value y"))
x,y= y,x
print("x:",x)
print("y:",y)
square and cube
ردحذفa= 2
s= 2**2
c= 2**3
print(s,c)
#3 wap to reversed the five-digit number where the first and last digit will be in the same position:-
ردحذفnum=52341
a=num%10 #1
num=num//10 #
b=num%10 #2
num=num//10 #
c=num%10 #0
num=num//10 #
d=num%10 #0
num=num//10 #
e=num%10 #1
num1=(e*10000+b*1000+c*100+d*10+a*1)
print(num1)
Salary Calculator Program Solution:-
ردحذفbasic = float(input("Enter basic salary of employee"))
ta = float(input("Enter TA"))
da = float(input("Enter DA"))
comm = float(input("Enter commision"))
pf = float(input("Enter pf "))
nl = float(input("Enter number of leave"))
gsal = basic+ta+da+comm+pf
tsal = basic+ta+da+comm-pf
nsal = gsal-((tsal/30)*nl)
print("Gross salary of employee is "+str(gsal)) # str() is used to convert float type data to string type
print("NET salary of employee is %.2f" % nsal)
num=int(input("Enter a 5 digit number"))
ردحذفa=num%10
num=num//10
b=num%10
num=num//10
c=num%10
num=num//10
d=num%10
num=num//10
e=num%10
num=num//10
num2=e*10000+b*1000+c*100+d*10+a*1
print(num2)
P=int(input("enter principle amount"))
ردحذفR=float(input("enter interest rate"))
T=float(input("enter time period"))
CI=P*(1+R/100)**T
print("ci is",CI)
num=int(input("enter a number"))
ردحذفsquare=num**2
cube=num**3
print("{0} square is {1} and cube is {2}".format(num,square,cube))
num=int(input("enter a number"))
ردحذفsquare=num**2
cube=num**3
print("{0} square is {1} and cube is {2}".format(num,square,cube))
num=12345
ردحذفa=num%10
num=num//10
b=num%10
num=num//10
c=num%10
num=num//10
d=num%10
e=num//10
num1=e*10000+b*1000+c*100+d*10+a*1
print(num1)
X=int(input("Enter the value of X : "))
ردحذفY=int(input("Enter the value of Y : "))
print ("Before swapping: ")
print("Value of X : ", X, " and Y : ", Y)
X,Y = Y,X
print ("After swapping: ")
print("Value of X : ", X, " and Y : ", Y)
'''WAP to calculate compound interest?'''
ردحذفp,r,t=int(input("enter principal:-")),float(input("enter rate:-")),int(input("enter time:-"))
ci=p*((1+r/100)**t) #p*(pow((1+r/100),t))
print(ci)
'''WAP to reverse the five-digit number where the first and last digit will be in the same position'''
ردحذفn=int(input("enter five digit number:-"))
a=n%10
n=n//10
b=n%10
n=n//10
c=n%10
n=n//10
d=n%10
n=n//10
e=n%10
n=n//10
print(e,b,c,d,a)
'''WAP to calculate square and cube of any entered number?'''
ردحذفn=int(input("enter any number:-"))
print("square is:-",n*n,"\nqube is:-",n*n*n)
SONAM SINGH
ردحذف"WAP to reverse the five digit number where the first and last digit number will be in the same position "
num=12345
print=("enter the real value ,num")
a=num%10#5
num=num//10
b=num%10
num=num//10
c=num%10
num=num//10
d=num%10
num=num//10
e=num//10
num1=(e*10000+d*1000=c*100+b*10+a*1)
print("enter the reverse value")
SONAM SINGH
ردحذفWAP TO SIMPLE INTEREST
p=int(input("enter the principal value"))
r=int(input("enter the rate value"))
t=int(input("enterthe time value"))
si=int(p*r*t)/100
print("simple interst",si)
SONAM SINGH
ردحذفWAP to calculate the compound interest
p = int(input("Enter principal value "))
r = int(input("Enter rate of interest" ))
t = int(input("Enter time period "))
total_value = p * ((1 + (r/100)) ** t)
print("Total Amount = %.2f"%total_value)
ci=(total_value-p)
print(ci)
SONAM SINGH
ردحذفWAP to calculate the compound interest
p = int(input("Enter principal value "))
r = int(input("Enter rate of interest" ))
t = int(input("Enter time period "))
total_value = p * ((1 + (r/100)) ** t)
print("Total Amount = %.2f"%total_value)
ci=(total_value-p)
print(ci)
#WAP to calculate the salary of the employee where basic, ta, da, comm, pf, leave will be entered by the user?
ردحذفbasic=30000
ta=300
da=200
comm=500
pf=500
hra=300
leave=10
total=basic+ta+da+comm-pf+hra
salary=total-(total/30)*leave
print("total salary is",salary)
output=20533.33
# wap to calculate the total salary of an enployee where basic,ta,da comm, pf,hrs,leave will be entered by the user?
ردحذف#basic(basic salary )
#ta(trevelling allowance)
#da(dearness allowance)
#comm(coneyance allowance)
#pf(prvident fund)
#hra(House rent allowance)
#leav(leave)
basic=float(input("enter the basic salary"))
ta=float(input("enter the trevelling allowance"))
da=float(input("enter the dearmess allowance"))
comm=float(input("enter the coneyance allowance"))
pf=float(input("enter the provident fund"))
hra=float(input("enter the home rent allowance"))
leave=float(input("enter the leave"))
tot=(basic+ta+da+comm-pf+hra)
print("total salary with out leave is",tot)
aday=(basic/30)
totcut=(leave*aday)
tot1=(tot-totcut)
print("total salary of employee with leave is",tot1)
# wap to calculate the total salary of an enployee where basic,ta,da comm, pf,hrs,leave will be entered by the user?
ردحذف#basic(basic salary )
#ta(trevelling allowance)
#da(dearness allowance)
#comm(coneyance allowance)
#pf(prvident fund)
#hra(House rent allowance)
#leav(leave)
basic=float(input("enter the basic salary"))
ta=float(input("enter the trevelling allowance"))
da=float(input("enter the dearmess allowance"))
comm=float(input("enter the coneyance allowance"))
pf=float(input("enter the provident fund"))
hra=float(input("enter the home rent allowance"))
leave=float(input("enter the leave"))
tot=(basic+ta+da+comm-pf+hra)
print("total salary with out leave is",tot)
aday=(basic/30)
totcut=(leave*aday)
tot1=(tot-totcut)
print("total salary of employee with leave is",tot1)
# compound intrest program
ردحذفp= float(input(" enter the value of p "))
r= float(input(" enter the value of r "))
t= float(input(" enter the value of t "))
n=12
R=r/100
A=(p*(1+R/n)**(n*t))
print(" the compund interst is ",A,A-p)
#WAP to Reverse Five Digit Number where first and last digit is same.
ردحذفnum=int(input("enter five digit no."))
a=num%10
num=num//10
b=num%10
num=num//10
c=num%10
num=num//10
d=num%10
e=num//10
rev=a*1+b*1000+c*100+d*10+e*10000
print("the reverse value is",rev)
#program of swiping without third virable
ردحذفa=input(" enter the first value")
b=input(" enter second value")
a,b = b,a
print(" the value of a is",a , "the value of b is ",b)
#WAP to calculate Square and Cube of any assigned number.
ردحذفa=int(input("enter number for square and cube"))
square=(a*a)
print("the assigned square is",square)
cube=(a*a*a)
print("the Assigned cube is", cube)
#WAP to calculate the salary of the employee where basic, ta, da, comm, pf, no. of leave will be entered by the user
ردحذفsalary= int(input("Enter the Salary"))
ta= int(input("Enter the ta"))
da= int(input("Enter the da"))
comm= int(input("Enter the comm"))
pf= int(input("Enter the pf"))
hra= int(input("Enter the hra"))
leave = int(input("Enter the leave"))
total=(salary + ta +da + comm -pf + hra)
print("Total salary without leave :",total)
single_day= salary/30
cut=leave*single_day
final=("The total amount after Leave", total-cut)
print(final)
#WAP to calculate compound interest
ردحذفp= float(input(" enter the p "))
r= float(input(" enter the r "))
t= float(input(" enter the t "))
n=6
R=r/100
total_amount =(p*(1+R/n)**(n*t))
print(" the total amount is ", total_amount)
ci=total_amount-p
print("the compound interest is", ci)
#to print reversed 5 digit number without changing first and last digit
ردحذفx=int(input("enter five digit number to reverse"))
a=x%10
x=x//10
b=x%10
x=x//10
c=x%10
x=x//10
d=x%10
e=x//10
reverse=a*1+b*1000+c*100+d*10+e*10000
print("the reverse value is",reverse)
#swapping of two unknown numbers without third variable
ردحذفx=int(input("enter first number"))
y=int(input("enter second number"))
x=x+y
y=x-y
x=x-y
print(x,y)
#WAP to calculate square and cube of any entered number
ردحذفa=int(input("enter a number to find square"))
square=(a*a)
print("the square is", square)
a=int(input("enter a number to find cube"))
cube=(a*a*a)
print("the cube is", cube)
#simple interest where rate and time is constant
ردحذفprinciple=int(input("enter the principle"))
rate=3
time=4
constant=(rate,time)
simple_interest=(principle*rate*time)/100
print(simple_interest)
name=input("Enter employee name:")
ردحذفbasic=float(input("Enter basic:"))
ta=float(input("Enter Travelling Allowance:"))
da=float(input("Enter Dearness Allowance:"))
comm=float(input("Enter commisson:"))
hra=float(input("enter house rent allowance:"))
leave=float(input("enter leave:"))
pf=float(input("enter providant fund:"))
netpay=(basic+ta+da+hra+comm)
deduction=(netpay/30)*leave
grosspay=(netpay-pf-deduction)
print("SALARY SLIP")
print("==============================================")
print("basic:",basic)
print("Travelling Allowance:",ta)
print("Dearness Allowance:",da)
print("commisson:",comm)
print("House rent Allowance:",hra)
print("No of Leave:",leave)
print("Providant fund:",pf)
print("===============================================")
print("Total salary:",netpay)
print("gross payment:",grosspay)
#reverse five digit number where first and last digit in same position
ردحذفa=int(input("Enter only five digit:"))
print(a)
n1=a%10 #5
a=a//10 #1234
n2=a%10 #4
a=a//10 #123
n3=a%10 #3
a=a//10 #12
n4=a%10 #2
a=a//10 #1
res=(a*10000+n2*1000+n3*100+n4*10+n1)
print(res)
# wap to reverse five digit number where first and last digit will be on same position?
ردحذفnum=int(input("enter any five digit number"))
r1=num%10
num1=num//10
r2=num1%10
num2=num1//10
r3=num2%10
num3=num2//10
r4=num3%10
num4=num3//10
r5=num4%10
result=r1*1+r2*1000+r3*100+r4*10+r5*10000
print(result)
#wap to calculate compound intrest?
ردحذفp=2000
r=3.5
t=2
n=3
A=p*((1+(r/n))**(n*t))
print("compound intrest",A)
#square and cube of the number?
ردحذف#square of the input number
a=int(input("enter any number"))
s=a*a
print("square is",s)
# cube of the input number
x=int(input("enter any number"))
c=x*x*x
print("cube is",c)
#wap to swap without using third variable?
ردحذفa=20
b=30
a=a+b
b=a-b
a=a-b
print(a,b)
basic=int(input("Please Enter Basic Salary"))
ردحذفta=int(input("Please Enter TA"))
da=int(input("Please Enter DA"))
com=int(input("Please Enter Comm"))
pf=int(input("Please Enter Pf"))
leave=int(input("Please Enter NO of Leave Employee"))
pd=30-leave
sal=basic+ta+da+com
csal=(sal/30)*pd
tsal=int(csal-pf)
print("No of Paid Days> ",pd)
print("Gross Salary> ",sal,"Rs.")
print("Deduction in Salary PF> ",pf,"Rs")
print("In Hand Salary> ",tsal,"Rs")