Top 3 Games in python | Beginners Game in Python| Simple Games in Python
Guessing Number Game in Python
import random
print("Welcome to Guessing Number Game")
name=input("Enter your name")
print("Let's Play ",name)
randomnumber=random.randrange(1,21)
print("\n")
guess=1;
while guess<=4:
guessnumber=int(input("Enter guess number between 1 to 20."))
if
guessnumber==randomnumber:
print("Congrats you won..")
elif
guessnumber<randomnumber:
print("your guess is too low")
elif
guessnumber>randomnumber:
print("your guess is too high")
guess=guess+1
if guessnumber!=randomnumber:
print("Sorry!
You lose the game")
Screenshot:
Guessing Number Game in Python |
Lucky Seven Game in Python | Lucky 7 game
import random
winamt= int(input("Enter the amount you want.."))
print("You will have only 4 chances to win the
game..")
chance=0
while(chance!=4):
rolldice1=random.randint(1,6)
rolldice2=random.randint(1,6)
totalnum=(rolldice1+rolldice2)
if(totalnum==7):
print("your dice roll is 7, you earned
the amount you want.")
else:
print("your dice roll is ",totalnum," , you loose the
game")
chance=chance+1
if(chance==4):
print("Sorry,
your chances are over.")
Screenshot:
Lucky 7 Game in Python |
Movie guessing game | Hangman Game in Python
import random
movies=['Aag','jung','jungle','bade
bhaiya','Aan','Nagin','Deewar','Deewane']
randomovie=random.choice(movies)
print("Guess the character of movie")
guesses=' '
turn=len(randomovie)
while turn>0:
failed=0
for char in
randomovie:
if char in
guesses:
print(char)
else:
print("_")
failed=failed+1
if failed==0:
print("you win")
print("The movie name is ",randomovie)
break
guess=input("enter the character: ")
guesses=guesses+guess
if guess not in
randomovie:
turn=turn-1
print("wrong")
if turn==0:
print("you loose the game.")
Screenshot:
Hangman Game in Python |
No comments:
Post a Comment