Skip to content

Instantly share code, notes, and snippets.

@kotajacob
Created September 29, 2016 00:32
Show Gist options
  • Save kotajacob/7f6aff769dcbdefc3ac5d77212ca9777 to your computer and use it in GitHub Desktop.
Save kotajacob/7f6aff769dcbdefc3ac5d77212ca9777 to your computer and use it in GitHub Desktop.
def get_can_option():
#RACE CLOSE
print ("Who will you vote for if the race is close?")
can1 = input("CANDIDATE = ")
#RACE NOT CLOSE
print ("Who will you vote for if the race is not close?")
can2 = input("CANDIDATE = ")
#loop through all the options we want, if for the first elif for the middle, else for the last
if (can1 == "Clinton" and can2 == "Clinton"):
return 1
elif (can1 == "Trump" and can2 == "Trump"):
return 2
elif (can1 == "Stein" and can2 == "Stein"):
return 3
elif (can1 == "Johnson" and can2 == "Johnson"):
return 4
#this ones a little wierd because they have to be unpredictable but the same both times
elif (can1 == can2):
return 5
elif (can1 == "Clinton" and can2 == "Stein"):
return 6
elif (can1 == "Trump" and can2 == "Johnson"):
return 7
#This next one is where things get a tad bit tricky
#first check if the first option is one of the candidates, then make sure the second is not
elif (can1 == "Clinton" or can1 == "Trump" or can1 == "Stein" or can1 == "Johnson" and can2 != "Clinton" and can2 != "Trump" and can2 != "Stein" and can2 != "Johnson"):
return 8
else:
return 9
#If all else fails
def main():
#CanOption = get_can_option()
can_option = get_can_option()
# c = clinton t = trump j = johnson s = stein o = other
# 1 c + c - moderate
# 2 t + t - conservative
# 3 s + s - liberal
# 4 j + j - liberatarian
# 5 o + o - radical
# 6 c + s - liberal playing it safe
# 7 t + j - fiscal conservative
# 8 c/t/j/s + o - radical playing it safe
# 9 other - unexpected
if can_option == 1:
print ("Moderate")
if can_option == 2:
print ("Conservative")
if can_option == 3:
print ("Liberal")
if can_option == 4:
print ("Liberatarian")
if can_option == 5:
print ("Radical")
if can_option == 6:
print ("Liberal playing it safe")
if can_option == 7:
print ("Fiscal Conservative")
if can_option == 8:
print ("Radical playing it safe")
if can_option == 9:
print ("unexpected")
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment