Ask Question
15 March, 02:12

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. 15 March, 02:23
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers