Skip to content

Instantly share code, notes, and snippets.

@Miha-Pleskovic
Created July 23, 2016 13:57
Show Gist options
  • Save Miha-Pleskovic/90a2bb327fdb4a274feac5468ba6ef4b to your computer and use it in GitHub Desktop.
Save Miha-Pleskovic/90a2bb327fdb4a274feac5468ba6ef4b to your computer and use it in GitHub Desktop.
FizzBuzz
# -*- coding: utf-8 -*-
def fb_en():
print "Welcome to FIZZBUZZ!"
print ""
while True:
tutorial = raw_input("Would you like a tutorial? (1 - yes | 2 - no) ")
if tutorial == "1":
print "FIZZBUZZ is really simple."
print "1. Type in a number between 1 and 100."
print "2. The program will count up to your desired number. If the number is divisible by 3,"
print " it will shout FIZZ. If the number is divisible by 5, it will shout BUZZ."
print " And if it's divisible by 15, you'll get FIZZBUZZ. Fun, fun."
print ""
break
elif tutorial == "2":
print ""
break
else:
print "Please type 1 for YES or 2 for NO."
continue
while True:
number = raw_input("Enter your number: ")
if number.isdigit() == False:
print "Please enter a number between 1 and 100."
continue
elif 0 < int(number) < 101:
for x in range(1, int(number) + 1):
if x % 3 == 0 and x % 5 == 0:
print "FIZZBUZZ!!!"
elif x % 5 == 0:
print "BUZZ!"
elif x % 3 == 0:
print "FIZZ!"
else:
print x
break
else:
print "Please enter a number between 1 and 100."
continue
print ""
while True:
play_again = raw_input("Would you like to play again? (1 - yes | 2 - no) ")
if play_again == "1":
fb_en()
break
elif play_again == "2":
print "Goodbye."
break
else:
print "Please try again."
continue
def fb_sl():
print "Dobrodošli v ŠPICPARKELJCU!"
print ""
while True:
tutorial = raw_input("Bi radi prebrali navodila? (1 - da | 2 - ne) ")
if tutorial == "1":
print "ŠPICPARKELJC je zares preprost."
print "1. Vpišite številko med 1 in 100."
print "2. Program bo začel šteti vse do vašega števila. Če je število deljivo s 3,"
print " bo vzkliknilo ŠPIC. Če je število deljivo s 5, bo vzkliknilo PARKELJC."
print " In če bo deljivo s 15, boste dobili ŠPICPARKELJC. Kako zabavno."
print ""
break
elif tutorial == "2":
print ""
break
else:
print "Prosimo, vpišite 1 za DA ali 2 za NE."
continue
while True:
number = raw_input("Vpišite številko: ")
if number.isdigit() == False:
print "Prosimo, vpišite število med 1 in 100."
continue
elif 0 < int(number) < 101:
for x in range(1, int(number) + 1):
if x % 3 == 0 and x % 5 == 0:
print "ŠPICPARKELJC!!!"
elif x % 5 == 0:
print "PARKELJC!"
elif x % 3 == 0:
print "ŠPIC!"
else:
print x
break
else:
print "Prosimo, vpišite število med 1 in 100."
continue
print ""
while True:
play_again = raw_input("Bi radi igrali znova? (1 - da | 2 - ne) ")
if play_again == "1":
fb_sl()
break
elif play_again == "2":
print "Nasvidenje."
break
else:
print "Prosimo, poskusite znova."
continue
while True:
language = raw_input("Choose your language (1 - English | 2 - Slovenian): ").lower()
if language == "1" or language == "english":
fb_en()
break
elif language == "2" or language == "slovenian":
fb_sl()
break
else:
print "Please try again."
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment