{"id":12868,"date":"2023-04-08T20:53:11","date_gmt":"2023-04-08T20:53:11","guid":{"rendered":"https:\/\/www.goodacademic.com\/blog\/questions\/write-a-program-that-prompts-the-user-for-the-number-of-miles-driven-and-the-gallons-of-gas-used-your-code-should-then-calculate-the-cars-mpg-and-display-the-result\/"},"modified":"2023-04-08T20:53:11","modified_gmt":"2023-04-08T20:53:11","slug":"write-a-program-that-prompts-the-user-for-the-number-of-miles-driven-and-the-gallons-of-gas-used-your-code-should-then-calculate-the-cars-mpg-and-display-the-result","status":"publish","type":"questions","link":"https:\/\/www.goodacademic.com\/blog\/questions\/write-a-program-that-prompts-the-user-for-the-number-of-miles-driven-and-the-gallons-of-gas-used-your-code-should-then-calculate-the-cars-mpg-and-display-the-result\/","title":{"rendered":"Write a program that prompts the user for the number of miles driven and the gallons of gas used. Your code should then calculate the car\u2019s MPG and display the result."},"content":{"rendered":"<p>In class this week we started Python programming. Please review the slides entitled Phyton Basics then rewrite the code for the Calculator App in www.repl.it. Based on your understanding of the Calculator App you will complete the Miles Per Gallon Assignment. Once completed, you will copy your code, paste into notepad, word or google doc then upload to the assignment dropbox for grading.<\/p>\n<div>Good luck.\n<\/div>\n<div><\/div>\n<div>Calculator App\n<\/div>\n<div>Mark as done\n<\/div>\n<div>#This is a calculator application\n<\/div>\n<div>#greet the user\n<\/div>\n<div>print(&#8216;Greetings!!&#8217;)\n<\/div>\n<div>#Enter the first number\n<\/div>\n<div>num1 = float(input(&#8220;Enter the first number: &#8220;))\n<\/div>\n<div>#Enter the 2nd number\n<\/div>\n<div>num2 = float(input(&#8220;Enter the second number: &#8220;))\n<\/div>\n<div>#Enter the 3rd number\n<\/div>\n<div>num3 = float(input(&#8220;Enter the third number: &#8220;))\n<\/div>\n<div>#total the numbers entered.\n<\/div>\n<div>sum = num1+num2+num3\n<\/div>\n<div>#display the result\n<\/div>\n<div>print(sum)\n<\/div>\n<div><\/div>\n<div>Instructions:\n<\/div>\n<div>Complete program below and upload to Moodle under assignment named \u201cPython Lab (Miles per Gallon). Remember to comment your code with program name, your name, and date.\n<\/div>\n<div>1. Miles-per-Gallon\n<\/div>\n<div>A car\u2019s miles-per-gallon (MPG) can be calculated with the following formula:\n<\/div>\n<div>MPG =     Milesdriven\n<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;\n<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Gallonsgasused\n<\/div>\n<div>Write a program that prompts the user for the number of miles driven and the gallons of gas used. Your code should then calculate the car\u2019s MPG and display the result.\n<\/div>\n<div>In class this week we started Python programming. Please review the slides entitled Phyton Basics then rewrite the code for the Calculator App in www.repl.it. Based on your understanding of the Calculator App you will complete the Miles Per Gallon Assignment. Once completed, you will copy your code, paste into notepad, word or google doc then upload to the assignment dropbox for grading.\n<\/div>\n<div>Good luck.\n<\/div>\n<div>Calculator App\n<\/div>\n<div>Mark as done\n<\/div>\n<div>#This is a calculator application\n<\/div>\n<div>#greet the user\n<\/div>\n<div>print(&#8216;Greetings!!&#8217;)\n<\/div>\n<div>#Enter the first number\n<\/div>\n<div>num1 = float(input(&#8220;Enter the first number: &#8220;))\n<\/div>\n<div>#Enter the 2nd number\n<\/div>\n<div>num2 = float(input(&#8220;Enter the second number: &#8220;))\n<\/div>\n<div>#Enter the 3rd number\n<\/div>\n<div>num3 = float(input(&#8220;Enter the third number: &#8220;))\n<\/div>\n<div>#total the numbers entered.\n<\/div>\n<div>sum = num1+num2+num3\n<\/div>\n<div>#display the result\n<\/div>\n<div>print(sum)\n<\/div>\n<div>Instructions:\n<\/div>\n<div>Complete program below and upload to Moodle under assignment named \u201cPython Lab (Miles per Gallon). Remember to comment your code with program name, your name, and date.\n<\/div>\n<div>1. Miles-per-Gallon\n<\/div>\n<div>A car\u2019s miles-per-gallon (MPG) can be calculated with the following formula:\n<\/div>\n<div>MPG =     Milesdriven\n<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;\n<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Gallonsgasused\n<\/div>\n<div>Write a program that prompts the user for the number of miles driven and the gallons of gas used. Your code should then calculate the car\u2019s MPG and display the result.\n<\/div>\n<div>In class this week we started Python programming. Please review the slides entitled Phyton Basics then rewrite the code for the Calculator App in www.repl.it. Based on your understanding of the Calculator App you will complete the Miles Per Gallon Assignment. Once completed, you will copy your code, paste into notepad, word or google doc then upload to the assignment dropbox for grading.\n<\/div>\n<div>Good luck.\n<\/div>\n<div>Calculator App\n<\/div>\n<div>Mark as done\n<\/div>\n<div>#This is a calculator application\n<\/div>\n<div>#greet the user\n<\/div>\n<div>print(&#8216;Greetings!!&#8217;)\n<\/div>\n<div>#Enter the first number\n<\/div>\n<div>num1 = float(input(&#8220;Enter the first number: &#8220;))\n<\/div>\n<div>#Enter the 2nd number\n<\/div>\n<div>num2 = float(input(&#8220;Enter the second number: &#8220;))\n<\/div>\n<div>#Enter the 3rd number\n<\/div>\n<div>num3 = float(input(&#8220;Enter the third number: &#8220;))\n<\/div>\n<div>#total the numbers entered.\n<\/div>\n<div>sum = num1+num2+num3\n<\/div>\n<div>#display the result\n<\/div>\n<div>print(sum)\n<\/div>\n<div>Instructions:\n<\/div>\n<div>Complete program below and upload to Moodle under assignment named \u201cPython Lab (Miles per Gallon). Remember to comment your code with program name, your name, and date.\n<\/div>\n<div>1. Miles-per-Gallon\n<\/div>\n<div>A car\u2019s miles-per-gallon (MPG) can be calculated with the following formula:\n<\/div>\n<div>MPG =     Milesdriven\n<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;\n<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Gallonsgasused\n<\/div>\n<div>Write a program that prompts the user for the number of miles driven and the gallons of gas used. Your code should then calculate the car\u2019s MPG and display the result.\n<\/div>\n<div>In class this week we started Python programming. Please review the slides entitled Phyton Basics then rewrite the code for the Calculator App in www.repl.it. Based on your understanding of the Calculator App you will complete the Miles Per Gallon Assignment. Once completed, you will copy your code, paste into notepad, word or google doc then upload to the assignment dropbox for grading.\n<\/div>\n<div>Good luck.\n<\/div>\n<div><\/div>\n<div><\/div>\n<div>Calculator App<\/div>\n<div><\/div>\n<div>#This is a calculator application\n<\/div>\n<div>#greet the user\n<\/div>\n<div>print(&#8216;Greetings!!&#8217;)\n<\/div>\n<div>#Enter the first number\n<\/div>\n<div>num1 = float(input(&#8220;Enter the first number: &#8220;))\n<\/div>\n<div>#Enter the 2nd number\n<\/div>\n<div>num2 = float(input(&#8220;Enter the second number: &#8220;))\n<\/div>\n<div>#Enter the 3rd number\n<\/div>\n<div>num3 = float(input(&#8220;Enter the third number: &#8220;))\n<\/div>\n<div>#total the numbers entered.\n<\/div>\n<div>sum = num1+num2+num3\n<\/div>\n<div>#display the result\n<\/div>\n<div>print(sum)\n<\/div>\n<div><\/div>\n<div>Instructions:\n<\/div>\n<div>Complete program below and upload to Moodle under assignment named \u201cPython Lab (Miles per Gallon). Remember to comment your code with program name, your name, and date.\n<\/div>\n<div>1. Miles-per-Gallon\n<\/div>\n<div>A car\u2019s miles-per-gallon (MPG) can be calculated with the following formula:\n<\/div>\n<div>MPG =     Milesdriven\n<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;\n<\/div>\n<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Gallonsgasused\n<\/div>\n<div><\/div>\n<div><\/div>\n<div>Write a program that prompts the user for the number of miles driven and the gallons of gas used. Your code should then calculate the&nbsp;<\/div>\n<div>car\u2019s MPG and display the result.\n<\/div>\n<div><\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n<div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In class this week we started Python programming. Please review the slides entitled Phyton Basics then rewrite the code for the Calculator App in www.repl.it. Based on your understanding of the Calculator App you will complete the Miles Per Gallon Assignment. Once completed, you will copy your code, paste into notepad, word or google doc [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":[],"disciplines":[211],"paper_types":[],"tagged":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/questions\/12868"}],"collection":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/questions"}],"about":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/types\/questions"}],"author":[{"embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/comments?post=12868"}],"version-history":[{"count":0,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/questions\/12868\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/media?parent=12868"}],"wp:term":[{"taxonomy":"disciplines","embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/disciplines?post=12868"},{"taxonomy":"paper_types","embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/paper_types?post=12868"},{"taxonomy":"tagged","embeddable":true,"href":"https:\/\/www.goodacademic.com\/blog\/wp-json\/wp\/v2\/tagged?post=12868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}