curriculum/challenges/english/blocks/daily-coding-challenges-python/691b559495c5cb5a37b9b487.md
Given the speed you are traveling in miles per hour (MPH), and a speed limit in kilometers per hour (KPH), determine whether you are speeding and if you will get a warning or a ticket.
"Not Speeding"."Warning"."Ticket".speed_check(30, 70) should return "Not Speeding".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(speed_check(30, 70), "Not Speeding")`)
}})
speed_check(40, 60) should return "Warning".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(speed_check(40, 60), "Warning")`)
}})
speed_check(40, 65) should return "Not Speeding".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(speed_check(40, 65), "Not Speeding")`)
}})
speed_check(60, 90) should return "Ticket".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(speed_check(60, 90), "Ticket")`)
}})
speed_check(65, 100) should return "Warning".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(speed_check(65, 100), "Warning")`)
}})
speed_check(88, 40) should return "Ticket".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(speed_check(88, 40), "Ticket")`)
}})
def speed_check(speed_mph, speed_limit_kph):
return speed_mph
def speed_check(speed_mph, speed_limit_kph):
speed_kph = speed_mph * 1.60934
if speed_kph <= speed_limit_kph:
return "Not Speeding"
over = speed_kph - speed_limit_kph
if over <= 5:
return "Warning"
return "Ticket"