0% found this document useful (0 votes)
12 views2 pages

Exp 1 08

The document contains a series of Python code snippets for various tasks including greeting users, calculating areas of geometric shapes, performing arithmetic operations, converting currencies, and calculating simple interest. Each section prompts the user for input and outputs the results accordingly. The examples demonstrate basic programming concepts and user interaction in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Exp 1 08

The document contains a series of Python code snippets for various tasks including greeting users, calculating areas of geometric shapes, performing arithmetic operations, converting currencies, and calculating simple interest. Each section prompts the user for input and outputs the results accordingly. The examples demonstrate basic programming concepts and user interaction in Python.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

In [1]: #GREETING

name= input("Enter your name:")


t= input("Enter time of day e.g.,(Morning,Afternoon,Evening):").strip()
ocassion= input("Enter ocassion e.g.,(Birthday,anniversary):").strip()

greeting = "Hello," +name+ "!\n"


greeting +="Good " +t+ "!\n"
greeting +="Happy" +ocassion.capitalize()+ "!\n"
greeting +="May you have a great day ahead!"
print("\n" + greeting)

Hello,Siddhesh!
Good Morning!
HappyBirthday!
May you have a great day ahead!

In [2]: #CIRCLE
radius=float(input("Enter the radius:"))
area=3.14*radius**2
print("Enter area of circle",area)

Enter area of circle 78.5

In [3]: #TRIANGLE
height=float(input("Enter height"))
base=float(input("Enter breadth"))
area=0.5*height*base
print("Enter area",area)

Enter area 10.0

In [4]: #RECTANGLE
length=float(input("Enter length of rec:"))
breadth=float(input("Enter breadth of rec:"))
area=length*breadth
print("Enter area of rec",round(area,2))

Enter area of rec 1100.0

In [5]: #ARITHMETIC OPERATIONS


x=float(input("Enter the first number"))
y=float(input("Enter the second number"))
print("Addition of two nos",x+y)
print("subtraction of two nos",x-y)
print("Divison of two nos",round(x/y,2))
print("Quotient of two nos",x//y)
print("Remainder of two nos",x%y)
print("Multiplication of two nos",x*y)

Addition of two nos 99.0


subtraction of two nos -41.0
Divison of two nos 0.41
Quotient of two nos 0.0
Remainder of two nos 29.0
Multiplication of two nos 2030.0

In [6]: #RUPEES TO DOLLAR


rupee= float(input("Enter the amount of indian rupees(INR):"))
exchange =float(input("Enter the amount from USD to rupees:"))
# 1 dollar=86.63
dollar=rupee/exchange
#print(f'INR {rupee} is equal to $ {dollar:.2f}')
print('INR {} is equal to $ {:.2f}'.format(rupee,dollar))

INR 230.0 is equal to $ 2.65

In [7]: #DEGREE TO FAHRENIT


degree=float(input("enter degree celsius:"))
fahrenheit= (degree*(9/5)+32)
print("Enter ans :",round(fahrenheit,2))

Enter ans : 95.0

In [8]: #INCH TO FEET


inch=float(input("Enter value in inches:"))
feet=(inch/12)
print(f'conversion of {inch} to {feet:.2f} feet')

conversion of 24.0 to 2.00 feet

In [9]: #SALARY BREAKDOWN


BS=float(input("Enter the basic salary"))
DA=0.70*BS
TA=0.30*BS
HRA=0.10*BS
GS=DA+TA+HRA+BS
print(".....Salary Breakdown...")
print("basic salary:",BS)
print("dearness allowance:",DA)
print("travel allowance:",TA)
print("house rent allowance:",HRA)
print("gross salary:",GS)

.....Salary Breakdown...
basic salary: 100000.0
dearness allowance: 70000.0
travel allowance: 30000.0
house rent allowance: 10000.0
gross salary: 210000.0

In [15]: #SIMPLE INTEREST


Principal=float(input("Enter the principal amount:"))
Rate=float(input("Enter the rate of interest:"))
Time=float(input("Enter the time period:"))
simple_interest=(Principal*Rate*Time)/100
final=Principal+simple_interest
print(".....SIMPLE INTEREST CALCULATOR.....")
print("principal amount",Principal)
print("rate of interest",Rate)
print("time period",Time)
print("simple interest",simple_interest)
print("final amount",final)

.....SIMPLE INTEREST CALCULATOR.....


principal amount 50000.0
rate of interest 10.0
time period 5.0
simple interest 25000.0
final amount 75000.0

In [17]: #ARITHMATIC OPERATIONS


x=float(input("Enter first number:"))
y=float(input("Enter second number:"))
print("Sum of two nos",x+y)
print("Sub of two nos",x-y)
print ("Multiplication of two nos",x*y)
print("quotient is",x/y)
print("Remainder is",x%y)

Sum of two nos 47.7


Sub of two nos 3.099999999999998
Multiplication of two nos 566.42
quotient is 1.1390134529147982
Remainder is 3.099999999999998

In [ ]:

You might also like