Created
September 30, 2016 09:34
-
-
Save buzibu/6eba453b0d38d533aa0a545f36fc4918 to your computer and use it in GitHub Desktop.
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Fri Sep 30 11:38:12 2016 | |
@author: Vladislav.Zaimov | |
""" | |
input_string = input("Input: ").lower() | |
my_list = [x.strip() for x in input_string.split(",")] | |
h_streak = 0 | |
t_streak = 0 | |
max_h_streak = 0 | |
max_t_streak = 0 | |
for ch in my_list: | |
if ch == 'h': | |
h_streak += 1 | |
if h_streak > max_h_streak: | |
max_h_streak = h_streak | |
t_streak = 0 | |
elif ch == 't': | |
t_streak += 1 | |
if t_streak > max_t_streak: | |
max_t_streak = t_streak | |
h_streak = 0 | |
else: | |
print("Ingnoring invalid value {}".format(ch)) | |
#print(my_list) | |
#print("H: {} , T: {}".format(max_h_streak,max_t_streak)) | |
if max_h_streak > max_t_streak: | |
print ("H wins!") | |
elif max_h_streak < max_t_streak: | |
print ("T wins!") | |
else: | |
print ("Draw!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment