From 73ea895a8aef5564b046f85f8aafff2a1750e4f9 Mon Sep 17 00:00:00 2001 From: Rib Date: Sat, 8 Apr 2017 14:39:56 -0500 Subject: [PATCH 1/2] added algorithms folder --- rib_ribble/algorithms/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 rib_ribble/algorithms/.keep diff --git a/rib_ribble/algorithms/.keep b/rib_ribble/algorithms/.keep new file mode 100644 index 0000000..e69de29 From e55854d2e4c65c9439f4cb2c4f8ca94c4f61f9fd Mon Sep 17 00:00:00 2001 From: Rib Date: Sat, 8 Apr 2017 17:13:13 -0500 Subject: [PATCH 2/2] added coin_toss --- rib_ribble/assignments/python_fun/coin_toss.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 rib_ribble/assignments/python_fun/coin_toss.py diff --git a/rib_ribble/assignments/python_fun/coin_toss.py b/rib_ribble/assignments/python_fun/coin_toss.py new file mode 100644 index 0000000..43a7077 --- /dev/null +++ b/rib_ribble/assignments/python_fun/coin_toss.py @@ -0,0 +1,18 @@ +import random + +def coin_toss(): + t_count = 0 + h_count = 0 + print "Starting the program..." + for i in range(5000): + random_num = random.randint(0, 1) + if random_num == 0: + t_count += 1 + result = "tail" + else: + h_count += 1 + result = "head" + print "Attempt #" + str(i + 1) + ": Flipping a coin... It's a " + result + "! ... Got " + str(t_count) + " tail(s) so far and " + str(h_count) + " head(s) so far" + print "Ending the program, thank you!" + +coin_toss() \ No newline at end of file