-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Thinkful-Logic Drills: Traffic light - python
- Loading branch information
1 parent
efc9b8e
commit 185c3a9
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# https://www.codewars.com/kata/58649884a1659ed6cb000072 | ||
# DESCRIPTION: | ||
# You're writing code to control your town's traffic | ||
# lights. You need a function to handle each change | ||
# from green, to yellow, to red, and then to green | ||
# again. | ||
# Complete the function that takes a string as an argument | ||
# representing the current state of the light and returns | ||
# a string representing the state the light should change | ||
# to. | ||
# For example, when the input is green, output should be | ||
# yellow. | ||
|
||
def update_light(current): | ||
dictionary = { | ||
"green": "yellow", | ||
"yellow": "red", | ||
"red": "green" | ||
} | ||
return dictionary[current] |