How to create Guessing game in Python
#shuffle
a=[1,2,3,4,5]
from random import shuffle
def my_shuffle(a):
shuffle(a)
return a
#guessing
def user_guessing():
guess=int(input("enter position no. from : 0,1,2,3,4: "))
return guess
#checking userguess with shuffle
def check_user_guess(user_guess,b):
if a[user_guess]==2:
print("congratulation your guess is right")
else:
print('sorry the right answer is: {}'.format(b.index(2)))
print(b)
check_user_guess(user_guess,b)
#final
b=my_shuffle(a)
user_guess=user_guessing()
check_user_guess(user_guess,b)