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

Respuesta :

Answer:

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".

ACCESS MORE
ACCESS MORE
ACCESS MORE
ACCESS MORE