473,394 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

calculating slowest speed

Hello,
I'm trying to change this script so that it calculates the speed of the slowest walker rather that the fastest walker. I know the change needs to happen in the while or if loop, but I don't know what exactly to change.

I'm still new to python and I'm not really sure where to start, any help would be appreciated. Thanks!

Expand|Select|Wrap|Line Numbers
  1. num_walkers = float(input("How many walkers in your group? "))
  2. dist = float(input("Enter the distance: "))
  3. time = float(input("Enter the time: "))
  4. speed = dist/time
  5. i = 1
  6. high_speed = speed
  7. while i < num_walkers:
  8.     dist = float(input("Enter the distance: "))
  9.     time = float(input("Enter the time: "))
  10.     speed = dist/time
  11.     if speed > high_speed:
  12.         high_speed = speed
  13.     i = i + 1
  14. print("The fastest speed in the walking group is: ",high_speed)
Feb 4 '15 #1

✓ answered by Rabbit

What does line 11 do?

3 1321
Rabbit
12,516 Expert Mod 8TB
What does line 11 do?
Feb 4 '15 #2
I changed the > to a < and it finds the slowest,thanks for the tip
Feb 4 '15 #3
Rabbit
12,516 Expert Mod 8TB
No problem, good luck with the rest of your project.
Feb 4 '15 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

29
by: Bart Nessux | last post by:
Just fooling around this weekend. Wrote and timed programs in C, Perl and Python. Each Program counts to 1,000,000 and prints each number to the console as it counts. I was a bit surprised. I'm not...
5
by: Nick | last post by:
I'm sure there is a way. Any suggestions. I would like to test how much processing time a certain function takes to complete and lest say modify that funtion and compare the speed. Thanks in...
4
by: almurph | last post by:
Hi everyone, Can you help me please? Say you have hashtable of about 500 key/value pairs. This hashtable has to parse a word. If the word matches the key the then said word must be replaced by...
40
by: kavi | last post by:
Hello friends, Could any one tell the way of calculating the speed of c program execution?
2
by: hemil.deshmukh | last post by:
Hi Folks, I have an asp.net 2.0 web page with about 3-4 gridview controls on it. Each of the gridview controls is bound to a SqlDataSource which calls a stored procedure. The number of records...
45
by: charles.lobo | last post by:
Hi, I have recently begun using templates in C++ and have found it to be quite useful. However, hearing stories of code bloat and assorted problems I decided to write a couple of small programs...
13
by: Ciaran | last post by:
Hi All, Is it faster to have mySql look up as much data as possible in one complex query or to have php do all the complex processing and submit lots of simple queries to the mysql database? ...
4
by: cmrhema | last post by:
Hello I am having a table where the speed of the vehicle at the respective time are stored. Now I should calculate distance the eg details of vehicle No(VNo), speed,datetime is given below vno ...
2
HaLo2FrEeEk
by: HaLo2FrEeEk | last post by:
I'm making a quick little ftp uploader as a test and I'm trying to track upload speed. I'm using a loop to write 2048 bytes at a time to the ftp stream, so my logic was to run the loop a predefined...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.