Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views4 pages

Assignment 4

The document contains a series of programming assignments that involve basic calculations such as salary computation, distance conversion, student marks aggregation, temperature conversion, and area calculations for geometric shapes. Each assignment includes input prompts, calculations, and output statements. The examples demonstrate the expected results for various inputs, showcasing the functionality of the programs.

Uploaded by

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

Assignment 4

The document contains a series of programming assignments that involve basic calculations such as salary computation, distance conversion, student marks aggregation, temperature conversion, and area calculations for geometric shapes. Each assignment includes input prompts, calculations, and output statements. The examples demonstrate the expected results for various inputs, showcasing the functionality of the programs.

Uploaded by

24divya693
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 4
‘911224, 9:22 PM Assignments #1. Ramesh’s basic salary is input through the keyboard. His dearness allowance is house rent allowance is 26¥ of basic salary. Write a program to calculate his gros salary=eval (input (‘Please enter the basic salary:")) da=round(salary*40/160,2) hra=round(salary*20/100,2) gross_salary=salary+darhra print(#'Ramesh’s dearness allowance is (da}') print(#'Ramesh’s house rent allowance is {hra}') print(#'Ramesh’s gross salary is {gross_salary}') Ramesh’s dearness allowance is 28000.0 Ramesh’s house rent allowance is 1400.6 Ramesh’s gross salary is 112000. #2. The distance between two cities (in km.) is input through the keyboard. Write a print this distance in meters, feet, inches and centimeters. distance-eval(input( ‘Please enter the distance between two cities (in km.):")) dist_m=distance*100e dist_f-distance*3280.84 dist_in=distance*39370.1 dist_cn=distance*1¢000 print(f'distance between two cities (in kn.): {distance}') print(f'distance between two cities (in meters.): (dist_n)') print(f'distance between two cities (in feet.): {dist_f}") print(#'distance between two cities (in inches.): {dist_in}') print(f'distance between two cities (in centineters.): {dist_cn}') distance between two cities (in km.): 5@ distance between two cities (in meters.): 5000 distance between two cities (in feet.): 164042.0 distance between two cities (in inches.): 1968505.0 distance between two cities (in centimeters.): 5ae000e #3, If the marks obtained by a student in five different subjects are input through aggregate marks and percentage marks obtained by the student. Assume that the maxi can be obtained by @ student in each subject is 100. /al(input( ‘Please enter the student obtained marks in Math :')) hindi-eval (input( ‘Please enter the student obtained marks in hindi :*)) english=eval(input('Please enter the student obtained marks in english :")) sc=eval (input (‘Please enter the student obtained marks in Science :')) ss-eval (input ("Please enter the student obtained marks in Social Science :')) aggregate_marks=math+hindi+englishsctss percentage_marks=round(aggregate_marks/500°100, 2) print(f'Student aggregate marks is (aggregate_marks}') print(f'student’s percentage marks is {(percentage_marks}%" ) Student aggregate marks is 45@ Student’s percentage marks is 90.0 #4, Temperature of a city in Fahrenheit degrees is input through the keyboard. writ ‘atemperature into Centigrade degrees. ‘ie:1/C:1Usors/Lenovo/DownloadsiAssignment. htm wa ‘911224, 9:22 PM Assignment Tenperature=eval (input('Please enter the Tenperature of a city in Fahrenheit degree Centigrade_degrees=round( ((Temperature-32)*9)/9,2) print(#"tenperature in Centigrade degrees is (Centigrade _degrees) C') temperature in Centigrade degrees is 8.0 C I #5. The Length & breadth of a rectangle and radius of a circle are input through th to calculate the area & perimeter of the rectangle, and the area & circumference 0 Amport math Iseval(input("Enter the length:")) beeval(input("Enter the breadth:")) reeval (input("Enter the radius:")) rarea=round(1*b, 2) rperimeter=round((1+b)*2,2) Carea-round(nath.pi*r*r,2) c_circumference=2*nath.pi*r print(f'Area of rectangle is {r_area)') print(f'Area of rectangle perineter is {r_perimeter}') print(f'Area of circle is {c_area}') print(f'Area of circle circumference is {c_circumference}') Area of rectangle is 4¢ ‘Area of rectangle perimeter is 26 Area of circle is 113.1 Area of circle circumference is 37.69911184307752 #Two numbers are input through the keyboard into two Locations C and D. Write a pro ni-eval(input("Enter First Number for locations ¢:*)) n2=eval(input("Enter Second Number for locations D:")) nl=n2 print(f'content of locations C: {nl} ') neni print(f'content of locations D: {m2} ') content of locations C: 20 content of locations D: 28 47. If a five-digit number is input through the keyboard, write a program to revers nt(input ("Enter the five digits Nunber:")) revnun=2 10 =n//10 revnun=revnum+a*10000 10 v/10 revnun=revnum+a*1000 =n nen//20 revnun=revnum+a*10e acnxae nen//10 ‘ie:1/C:1Usors/Lenovo/DownloadsiAssignment. htm 218 ‘911224, 9:22 PM Assignments revnum=revnum+a*10 acnx10 print(*Reverse Five digits =",revnun) Reverse Five digits = 54321 #8. If a four-digit number is input through the keyboard, write a program to obtain adigit of this number. nizeval (input (‘enter the four digit nunbe é=round(nt/1000) mi=n1%1000 m2=n%100 mB=m2%10 _1_sun=dem3 print(f'sun of the first and last digit of this number: (f_ » sun}") sum of the first and last digit of this number: 5 #9. In q town, the percentage of men is 52. The percentage of total Literacy is 48. men is 35 of the total population, write a program to find the total number of iLL the population of the ton is 82,000. try: ‘town_population=80000 print (f'total population of town is {town_population}') total_men=0.52°80000 print(#'total population of men in the tow ‘total_wonen=80000-total_men print(f'total population of wonen in the town: {total_women}') total_literacy=0.48"80000 print(f'total literacy of town is (total_literacy)') mmen_Literacy=0.35*80000 print(f'men literacy of town is {men_literacy}') women_Literacy=total_literacy-men_Literacy print (F'women literacy of town is {women_literacy)') nen_{1literacy=total_men-men_literacy print (f'total men_illiteracy of town is {nen _dlliteracy}') Women_i1literacy=total_wonen-wonen_literacy print(#'total wonen illiteracy of town is {women_{1]iteracy}') total_illiteracy=men_{1literacyswonen_{lliteracy print(f'total illiteracy of town is {total_illiteracy)') {total_men}') except Exception as e: print(e) ‘ie:1/C:1Usors/Lenovo/DownloadsiAssignment. htm aia ‘911224, 9:22 PM Assignments total population of town is 8000 total population of men in the town: 4160.0 total population of women in the town: 38400.¢ total literacy of town is 38400. nen literacy of town is 28000.0 women literacy of town is 10400.¢ total men_illiteracy of town is 13600.¢ total women illiteracy of town is 28000.0 total illiteracy of town is 41600.¢ #10. A cashier has currency notes of denominations 19, 5@ and 160. If the amount to ‘through the keyboard in hundreds, find the total number of currency notes of each acashier will have to give to the withdrawer. amount=eval(input(’Enter amount to be withdrawn: ')) mi=amount X10 m2-amount%5@ m3-amount%100 {i:1#C:/Usors/LonovolDowntoadsiAssignment. html 48

You might also like