Skip to content

Instantly share code, notes, and snippets.

View odanga94's full-sized avatar

Odanga Ochieng' odanga94

  • Kenya
View GitHub Profile
@odanga94
odanga94 / Exercise18.py
Created May 16, 2017 05:56
PracticePython/Exercise18.py
import random
def play():
true_value = str(random.randint(1000, 9999))
guesses = 0
play = 'y'
while play == 'y':
cows = 0
bulls = 0
@odanga94
odanga94 / Exercise24.py
Created May 22, 2017 16:17
PracticePython/Exercise24
def draw_board():
n = int(raw_input("Enter the board size you want: "))
if n == 1:
print(" ---")
print("| |")
print(" ---")
else:
for i in range(n):
print(""),
@odanga94
odanga94 / Exercise33.py
Created May 28, 2017 11:46
PracticePython/Exercise33
def birthday_lookup():
birthdays = {"Albert Einstein": "14/03/1879", \
"Benjamin Franklin": "17/01/1706", "Ada Lovelace": "10/12/1815"}
print("Welcome to the birthday dictionary. We know the birthdays of: \
\nAlbert Einstein\nBenjamin Franklin\nAda Lovelace")
look_up = raw_input("Who's birthday do you want to look up? ")
print("%s's birthday is %s.") %(look_up, birthdays.get(look_up, "there is no such person in our dictionary"))
check_birthday = "y"
while check_birthday == "y":
@odanga94
odanga94 / Exercise28.py
Last active October 25, 2019 16:15
PracticePython/Exercise28
numbers = [70, 55, 100.5]
def max_(numbers):
greatest = numbers[0]
for x in numbers:
if x > greatest:
greatest = x
print(greatest)
max_(numbers)