0% found this document useful (0 votes)
5 views6 pages

Python Exp1

The document contains four Python programming problems with corresponding solutions. The first problem generates a personalized greeting, the second calculates areas of geometric figures, the third computes an employee's gross salary based on allowances, and the fourth demonstrates various types of operators in Python. Each program includes user input and outputs the results accordingly.

Uploaded by

mayureshteli772
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

Python Exp1

The document contains four Python programming problems with corresponding solutions. The first problem generates a personalized greeting, the second calculates areas of geometric figures, the third computes an employee's gross salary based on allowances, and the fourth demonstrates various types of operators in Python. Each program includes user input and outputs the results accordingly.

Uploaded by

mayureshteli772
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Roll number: 340

Problem Statement 1: Write a python code to generate Personalized Greeting.


Program:
print("Roll no: 340")
a=input("Enter you name: ")
b=int(input("Enter your roll no: "))
c=input("Enter your Branch: ")
print("Welcome",a)
print("Welcome to",c,"Branch and Your roll no is",b)

Output:
Roll number: 340
Problem Statement 2: Write a python program to calculate areas of any geometric figures like
circle, rectangle and triangle.
# Python Program to find the area of circle
Program:
print("Roll no : 340")
a = int(input("Enter radius of circle: "))
b = 3.147 * a*a
print("Area of circle is :",b,"unit")
c = int(input("Enter width of rectangle : "))
d = int(input("Enter length of rectangle : "))
e = c*d
print("Area of rectangle is : ",e,"unit")
f = int(input("Enter base of triangle : "))
g = int(input("Enter height of triangle : "))
h = 0.5*f*g
print("Area of Traingle is:",h,"unit")

Output:
Roll number: 340
Problem Statement 3: Write a Python program to calculate the gross salary of an employee. The
program should prompt the user for the basic salary (BS) and then compute the dearness
allowance (DA) as 70% of BS, the travel allowance (TA) as 30% of BS, and the house rent
allowance (HRA) as 10% of BS. Finally, it should calculate the gross salary as the sum of BS,
DA, TA, and HRA and display the result.
Program:
print("Roll no: 340")
BS = float(input("Enter basic salary:"))
DA = 0.70 * BS
TA = 0.30 * BS
HRA = 0.10 * BS
gross_salary = BS + DA + TA + HRA
print("Gross Salary is:", gross_salary)

Output:
Roll Number: 340
Problem Statement 4: Write a program to implement different types of operators in Python
Program:
print("Roll no : 340")
a=int(input("Enter first number :"))
b=int(input("Enter second number :"))
print("Arithmetic Operator")
print("Additon :",a+b)
print("Substraction :",a-b)
print("Multiplication :",a*b)
print("Relational Operator")
print("is a and b is equal",a==b)
print("is a is greater then b",a>b)
print("Logical Operator")
print(True and False)
print(True or False)
print(not True)
print("Assigment Operator")
a += 3
b -= 1
print(a)
print(b)
print("Identiy operator")
print(a is b)
print(a is not b)

Output:

You might also like