Write a Python programs to solve the following. Submit the code and screenshots
ID: 3535211 • Letter: W
Question
Write a Python programs to solve the following. Submit the code and screenshots ofÂ
your results. (6 pts each)
1) Write a program that uses standard input to displays the following pieces of informationÂ
about you, each on a separate line: Name, major, a hobby
2) An electronics company sells circuit boards at a 40% profit. Write a program that willÂ
calculate the selling price of a circuit board that costs $18.50
3) Write a program that converts kilometers to miles and meters to feet.
4) Running on a particular treadmill allows you to burn 3.9 calories per minute. Write aÂ
program that uses a loop to display the number of calories burned after 10, 15, 20, 25,Â
and 30 minutes
5) Write a program that asks for the names of three runners and the time it took each ofÂ
them to finish a race. Your program should display who came in first, second and thirdÂ
place.
Explanation / Answer
"""--------------------------------------------program 1:----------------------------------------------------------------------------------------------- """
name=raw_input("Enter your name: ");
major=raw_input("Enter your major: ");
hobby=raw_input("Enter your hobyy: ");
print "Information about you";
print "Name= ",name;
print "Major= ",major;
print "Hobby= ",hobby;
"""--------------------------------------------program 2:----------------------------------------------------------------------------------------------- """
cost=18.50;
profit=0.4;
sellingPrice=18.50+18.50*0.4;
print "selling price of circuit board= ",sellingPrice;
"""--------------------------------------------program 3:----------------------------------------------------------------------------------------------- """
print "kilometers to miles conversion ";
kilometers=raw_input("Enter the value in kilometers : ");
miles=float(kilometers)*0.6214;
print "miles= ",miles;
print "meters to feet conversion";
meters=raw_input("Enter the value in meters : ");
feet=float(meters)*3.2808;
print "feet= ",feet;
"""--------------------------------------------program 4:----------------------------------------------------------------------------------------------- """
rate=3.9;
minutes=[ 10,15,20,25,30];
for m in minutes:
print "calorie burned after ",m," minutes is ",m*3.9," calories";
"""----------------------------------------------program 5:--------------------------------------------------------------------------------- """
name=["","",""];
time=[0,0,0];
for i in range(0,3):
name[i]=raw_input("Enter runner name : ")
time[i]=raw_input("Enter the finishing time of him : ");
for i in range(0,2):
for j in range(i+1,3):
if(time[i]<time[j]):
temp=name[i];
name[i]=name[j];
name[j]=temp;
temp=time[i];
time[i]=time[j];
time[j]=temp;
print " first= ",name[0];
print " second= ",name[1];
print " third= ",name[2];
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.