Py Exercise3
Py Exercise3
Py Exercise3
ASSIGNMENT-3
1.
A bookstore needs to buy 60 copies of a book from a publisher. Suppose the cover price of a
book is X, but bookstores get a discount of Y%. Shipping costs incurs Z for the first copy and P
for each additional copy. What is the total wholesale cost for 60 copies to be paid by the
bookstore to the publisher?
X=eval(input("Enter cover price of a book "))
Y=eval(input("Enter discount percentage"))
Z=eval(input("Enter shipping cost for the first book "))
P=eval(input("Enter shipping cost for each additional copy "))
cost=(X-(X*Y/100))*60
shipping=Z+(P*59)
whole=cost+shipping
print("Wholesale price of 60 books is ",whole)
output:-
Enter cover price of a book 100
Enter discount percentage12
Enter shipping cost for the first book 15
Enter shipping cost for each additional copy 10
Wholesale price of 60 books is 5885.0
2.
Assume the population of a city consists of X persons of different age groups. X
includes both male and female. Public welfare department wants to find the
average age of male and female. The department can obtain peoples date of
birth from the corporation from which the age can be calculated. (Note: Use
only sequential statements to solve the problem. Consider X to be less than or
equal to 6)
OUPUT:-
Enter male or female M/FM
1.Enter your birthday date as DD-MM-YYYY01-12-2004
Enter male or female M/FM
2.Enter your birthday date as DD-MM-YYYY09-11-2000
Enter male or female M/FM
3.Enter your birthday date as DD-MM-YYYY23-05-1998
Enter male or female M/FF
4.Enter your birthday date as DD-MM-YYYY07-06-2005
Enter male or female M/FF
5.Enter your birthday date as DD-MM-YYYY11-08-2012
Enter male or female M/FF
6.Enter your birthday date as DD-MM-YYYY27-03-2001
Average age of male is 21.666666666666668
Average age of female is 17.0
Average age of people is 19.333333333333332
Enter a number :5
a= 3
b= 5
2. Temperature conversion from Fahrenheit to Celsius (Hint: Fahrenheit = 9/5 x Celsius + 32)
F=eval(input("Enter the Fahrenheit "))
C=(F-32)*(5/9)
print("The Celsius is" ,C)
OUTPUT:-
21
5. Compute the gross and net salaries of an employee for the given basic pay (BP) based on the
allowances and deductions. Gross pay includes basic and all allowances, Net pay is the difference
between gross pay and deductions. Allowances: DA = 62% of BP HRA = 8% of BP Deductions:
Insurance = Rs. 2000 PF = 12% of BP
DA=BP*62/100
HRA=BP*8/100
Insurance=2000
PF=BP*12/100
Gross_Pay=BP + DA + HRA
Deductions= Insurance + PF
Net_pay=Gross_Pay-Deductions
print("the net pay of the employee is ",Net_pay)
OUTPUT:-
6. Read two complex numbers from the user and find their a. sum b. difference c. product
c1=complex(input("Enter a complex number "))
c2=complex(input("Enter another complex number"))
print("sum=",c1+c2)
print("Difference=",c1-c2)
print("Product=",c1*c2)
OUTPUT:-