Python 3 with calculations

python 3

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

use codes and follow instructions please

you need to do calculations to make the codes as same as the demo (purple lines)

goal–> type codes that will end up the SAME as the demo (purple line)

you will need to define variables and you floats and int functions to calculate everything

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

#if you are an expert in python3 this would be easy for you.

Procedure
0. Create your Python file.
1. When this file is run, ask the following questions (in this order!), storing their answers as needed in
variables:
.
.
What is the name of the first city?
How fast is the train from the first city traveling (in feet per second)?
What is the name of the second city?
How fast is the train from the second city traveling (in feet per second)?
How far away are the two cities in miles)?
2. Calculate the time the two trains will meet as well as the distance from each city of their meeting place.
See http://mathforum.org/dr.math/faq/faq.two.trains.html if you need a refresher on how to calculate
this.
3. Print out your problem and your solution, pay special attention to the units and see the full example
below for exact formatting. Notes:
For precision, you’ll want to perform all calculations using floating point numbers, so make sure
to use / and // appropriately in your code.
For readability, you’ll want to display all numbers as whole numbers, so use int() to truncate
decimals before displaying any numbers to the user.
Note that blue text is typed by the user running the code, and that the OS-prompt is red, like $demo.
$demo python3 code.py
What is the name of the first city? Westford
How fast is the train from the first city traveling (in feet per second)? 100
What is the name of the second city? Eastford
How fast is the train from the second city traveling (in feet per second)? 88
How far away are the two cities (in miles)? 260
First city: Westford; Second city: Eastford; Distance: 260 miles
First train speed: 68 mph; Second train speed: 60 mph
Train One will meet Train Two after approximately 730212 feet.
Train Two will meet Train One after approximately 642587 feet.
The two trains will meet after: 0 days, 2 hours, 1 minutes, and 42 seconds.
Procedure
0. Create your Python file.
1. When this file is run, ask the following questions (in this order!), storing their answers as needed in
variables:
.
.
What is the name of the first city?
How fast is the train from the first city traveling (in feet per second)?
What is the name of the second city?
How fast is the train from the second city traveling (in feet per second)?
How far away are the two cities in miles)?
2. Calculate the time the two trains will meet as well as the distance from each city of their meeting place.
See http://mathforum.org/dr.math/faq/faq.two.trains.html if you need a refresher on how to calculate
this.
3. Print out your problem and your solution, pay special attention to the units and see the full example
below for exact formatting. Notes:
For precision, you’ll want to perform all calculations using floating point numbers, so make sure
to use / and // appropriately in your code.
For readability, you’ll want to display all numbers as whole numbers, so use int() to truncate
decimals before displaying any numbers to the user.
Note that blue text is typed by the user running the code, and that the OS-prompt is red, like $demo.
$demo python3 code.py
What is the name of the first city? Westford
How fast is the train from the first city traveling (in feet per second)? 100
What is the name of the second city? Eastford
How fast is the train from the second city traveling (in feet per second)? 88
How far away are the two cities (in miles)? 260
First city: Westford; Second city: Eastford; Distance: 260 miles
First train speed: 68 mph; Second train speed: 60 mph
Train One will meet Train Two after approximately 730212 feet.
Train Two will meet Train One after approximately 642587 feet.
The two trains will meet after: 0 days, 2 hours, 1 minutes, and 42 seconds.
Background
Programs are more interesting when they involve the user – supplying values to use in calculations, asking for
names, and so on. We can get a string from the user via the input() function, and then convert to other types
as needed via other built-in functions of Python, such as int(), float(), and bool().
Variables give us the chance to store values for later, recallable by name. We can even repeatedly update the
value associated with that name, as a replacement: forgetting the old value forever, remembering the new value
until further notice. As procedural programs are very much a sequence of executed instructions, the exact order
of when we store (or replace) a value for a variable, and when we look up and use the current value, is an
important part of understanding how to create the solution to a programming task.
This project will get us comfortable getting values of various types from the user and using variables while
calculating different things. We’ll explore control structures next, so be sure to master these more basic tasks
now.
The current task is to calculate the time and locations of two trains travelling in opposite directions. If you are
unfamiliar with this problem, see http://mathforum.org/dr.math/faq/faq.two.trains.html.

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER