speedtest

Solutions on MaxInterview for speedtest by the best coders in the world

showing results for - "speedtest"
Nelia
06 Feb 2020
1#pip3 install speedtest-cli
2import speedtest
3
4#function that gets the download speed in mega bytes per second
5def get_final_speed():
6    rawspeed = speedtest.Speedtest().download()
7    roundedspeed = round(rawspeed)
8    finalspeed = roundedspeed / 1e+6
9    return finalspeed
10
11#function that loops and calls on the above function
12def looped_av(y):
13    finalspeeds = 0
14    for i in range(y):
15        x = get_final_speed()
16        print(f'{i+1}. {x}mb/s')
17    return finalspeeds
18
19#menu loop
20while True:
21    repeat = input('1, 2, 3 or press {ENTER} to quit\n>>>')
22    if repeat == '1':
23        #single iteration
24        x = get_final_speed()
25        print(f'done, your download speed is {x}mb/s')
26    elif repeat == '2':
27        #2 iterations and finds the average speed
28        x = looped_av(2)
29        print(f'done, your average download speed is {x}mb/s')
30    elif repeat == '3':
31        #finds out how accurate the user wants the average to be, pretty pointless i know
32        times_through = int(input('how many times do you want the test to run?\n>>>'))
33        #iterates and finds the average download speed
34        x = looped_av(times_through)
35        print(f'done, your average download speed is {x}mb/s')  
36    else:
37        #breaks from the loop
38        break
Sofia
22 May 2020
1Test Speed VERY GOOD
Alex
05 Feb 2016
1You can use WebTools, it's an addon that gather the most useful and basic tools 
2such as a speedtest, a dictionary, a translator, a youtube convertor and
3many others (there are ten of them).
4You can access them in two clics, without having to open a new tab 
5and without having to search for them !
6
7-Chrome Link : 
8https://chrome.google.com/webstore/detail/webtools/ejnboneedfadhjddmbckhflmpnlcomge/
9
10Firefox link : https://addons.mozilla.org/fr/firefox/addon/webtools/
similar questions
queries leading to this page
speedtest