Tournament 2 in Python

Problem Statement:

Here, a person is participating in a race tournament. He runs every Sunday and tracks his speed every time. Speed may be good or bad than the previous Sunday. We are given his speed on some Sundays, we need to count the number of times he increases his speed than the previous Sunday.

Code for Tournament 2 in Python:

speed = input('Enter speed of each saturday: ').split()
for i in range(len(speed)):
    speed[i] = int(speed[i])
progress_count = 0
for i in range(1, len(speed)):
    if speed[i]>speed[i-1]:
        progress_count += 1
print('Progress count: ', progress_count)

Output:

Output for Tournament 2 in Python

Also Read:

Share:

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at admin@copyassignment.com Thank you