Skip to content

Instantly share code, notes, and snippets.

@midsonlajeanty
Last active June 23, 2022 02:18
Show Gist options
  • Select an option

  • Save midsonlajeanty/7ee1ee63baf562f5fb110ca1d3657c62 to your computer and use it in GitHub Desktop.

Select an option

Save midsonlajeanty/7ee1ee63baf562f5fb110ca1d3657c62 to your computer and use it in GitHub Desktop.
Jwèt Nonb Majik
from random import randrange
MAX = 100
CHANS = 5
nonb_kache = randrange(0, MAX)
print("Nonb_kache: ", nonb_kache)
print(f"Byenvini nan Jwèt la !\nOu gen {CHANS} Chans pou w jwenn yon nonb ant 0 ak {MAX}\n")
while True:
nonb_itilizate = input("Ki nonb lan : ")
if nonb_itilizate.isdigit():
nonb_itilizate = int(nonb_itilizate)
else:
print("Ou rantre yon valè ki pa bon. Eseye ankò.\n")
continue
if nonb_itilizate == nonb_kache:
print("Bravo Chanpyon, Ou Genyen Jwèt la !!!\n")
rejwe = input("Ou vle rejwe ankò ? (W/N) : ")
else:
CHANS -= 1
if nonb_itilizate > nonb_kache:
print("Ou fè fot, nonb la pi piti.")
elif nonb_itilizate < nonb_kache:
print("Ou fè fot, nonb la pi gwo.")
if CHANS == 0:
print("Malerezman , Ou Pèdi !!!\n")
rejwe = input("Ou vle rejwe ankò ? (W/N) : ")
else:
print(f"Ou rete {CHANS} chans, Eseye ankò !\n")
if 'rejwe' in locals():
if rejwe.lower() == "w":
CHANS = 5
nonb_kache = randrange(0, MAX)
print("Nonb_kache: ", nonb_kache)
print(f"Nou Kontan rejwe avè w !\nOu toujou gen {CHANS} Chans pou w jwenn yon nonb ant 0 ak {MAX}\n")
locals().pop('rejwe')
else:
print("Bye Bye Chanpyon !!!\n")
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment