Last active
March 26, 2020 17:07
-
-
Save lordvidex/ee7efd89b63f29aa9f2ded3cd1c1eac7 to your computer and use it in GitHub Desktop.
Evans Owamoyo:: Day 0 track 1
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
import 'dart:io'; | |
Map<String,int> band = const { | |
'black':0, | |
'brown':1, | |
'red':2, | |
'orange':3, | |
'yellow':4, | |
'green':5, | |
'blue':6, | |
'violet':7, | |
'grey':8, | |
'white':9, | |
}; | |
int calculate(String color) { | |
return band[color.toLowerCase()]; | |
} | |
void main() { | |
String input; | |
try{ | |
input = stdin.readLineSync(); //If run on console | |
}catch(e){ | |
//Color entered manually | |
input = 'Yellow'; | |
} | |
print('Band code: ${calculate(input.toLowerCase())}'); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment