Python Programming Dated 15-07-2021
Python Programming Dated 15-07-2021
Q1 Write a program to input principal Amount rate and time and calculate simple
interest.
Q2. Write a program to input two numebrs and swap their values using third variable
Swapping: Interchanging values of variable is called Swapping
Teachinque used in swapping
1) Using third variable
2) Without using third varaible
Q3. Write a program to input two numbers and swap their values without using third
variable.
a=10
b=5
a=a+b =10+5 a=15
b=a-b =15-5 b=10
a=a-b=15-10 a=5
Q4. Write a program to input basic salary, da, hra, pf and calculate net salary.
net=basic+da+hra-pf
Q5. Write a program to input basic salary and calcualte net salary.
da=50% of basic salary
hra=30% of basic salary
pf=10% of basic salary
net=basic+da+hra-pf
basic=float(input("Enter basic Salary"))
da=(basic*50)/100
hra=(basic*30)/100
pf=(basic*10)/100
net=basic+da+hra-pf
print("The basic salary is",basic)
print("The Da is",da)
print("The hra is",hra)
print("The pf is",pf)
print("The net Salary is",net)
Q6 Write a program to input marks in five subject out of 100 and calculate total
marks,
percentage marks, average marks.
15/07/2021
Q7 Write a program to input principal Amount rate and time and calculate
amount and compound interest.
Q8. Write a program to input 3 sides of a triangle and calcualte area of triangle
using
heros formaula.
#Note:
#b=a%10
# Divide the number a by 10 and remainder will store in variable.
Q10 Write a program to input any Five Digit number and find out the sum of its
first and last digit.
#Tracing
# a=12345 input
# b=a//10000 b=12345//10000 b=1
# c=a%10 =12345%10 c=5
# d=b+c =1+5=6
___________________________________________________________________________________
______
Type-2
Programs based on Conditional
Statement
if statement:
in this statenent first condition is checked and if the condtion is true then
statements are executed. if the condition is false then no statement is
executed.
Syntax:
if(Conditon):
Statement to be executed when condition is True
Example:
WAP to input your age and if your age is greater than equal to 18 then
display the message you are eligible for vote. otherwise display the
message you are not eligible for vote.
if..else statement
in this statenent first condition is checked and if the condtion is true then
a set of statement is executed if the conditon is false then another set of
statement is executed.
if(Conditon):
Statement to be executed when condition is True
else:
Statement to be executed when condition is False
Example:
WAP to input your age and if your age is greater than equal to 18 then
display the message you are eligible for vote. Otherwise display the
message you are not eligible for vote.
Example" WAP to input any number and check whether the entered number is
even or odd.
Example" WAP to input year number and check whether the entered year is
leap year or not.