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
#!/usr/bin/env ruby | |
VOWELS = "AEIOUYÅÄÖ" | |
CONSONANTS = ('A'..'Z').reject { |char| VOWELS.include? char } | |
def consonant? char | |
CONSONANTS.include? char or CONSONANTS.include? char.upcase | |
end | |
def rovarspraket string |
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 random | |
def sample(items): | |
# the first argument can be omitted as it defaults to 0 | |
randomIndex = random.randrange(len(items)) | |
return items[randomIndex] | |
def promptForGender(): | |
genderList = ["male", "female"] |
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 requests | |
for match in requests.get('http://worldcup.sfg.io/matches').json(): | |
if match['status'] == 'completed': | |
print('{home[code]} {home[goals]}, {away[code]} {away[goals]}' \ | |
.format(home=match['home_team'], away=match['away_team'])) |