473,399 Members | 3,302 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,399 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 1322
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.