Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyGuessTheNum
#python 3.6.9 #PyGuessTheNum: the number guessing game #this code is created by Rezaul Hoque on April 22,2022;contact: jewelmrh@yahoo.com #note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; import random def Deco(fun): def wrap(*args,**kwargs): print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>") fun(*args,**kwargs) print("April 22,2022") print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>") return wrap @Deco #@Deco is same as theFun= Deco(theFun) def theFun(s1,s2): print(f"{s1} {s2}") class Guess: def start(self): num= random.randint(1,15) for countNum in range(0,5): print('Guess a number between 1 and 15:\n') guess= int(input("Guess:\n")) countNum += 1 if guess<num: print("Your guess is too low") elif guess>num: print("Your guess is too high") else: break if guess==num: print (f"Congrats! You guess the number in {countNum} tries") else: print (f"Sorry! You failed to guess the number. It is {num}") theFun("\'Guess The Number\'","Game") a=Guess() a.start()
run
|
edit
|
history
|
help
0
PyRegCapGroup
Python
contarsucesoresmayores
isPythagorasTriplet.py
,..........(༎ຶ ෴ ༎ຶ)Hello my name.....(╯︵╰,).,
Ozan Taşdemir 9/B 499
PyMenuClass
Python
shuru9
Overview