Ask Question
21 May, 05:59

Codio Challenge Question (Python)

You are provided with 2 input values which determine the speed of 2 cars.

If either car is travelling at more than 70 then output 'fast cars'. Otherwise output 'ok'.

# Get our car speeds from the command line

import sys

speed1 = int (sys. argv[1])

speed2 = int (sys. argv[2])

# Write your code below

+3
Answers (1)
  1. 21 May, 06:48
    0
    if speed1 > 70 or speed2 > 70:

    print ("fast cars")

    else:

    print ("ok")

    Explanation:

    This is some very simple logic that will satisfy the requirements, we need to compare each speed against our speed limit (70) and if either (or) have exceeded it (>) then we need to output (print) "fast cars", otherwise we output "ok".
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Codio Challenge Question (Python) You are provided with 2 input values which determine the speed of 2 cars. If either car is travelling at ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers