21 Ka Game
21 Ka Game
import random
l = []
n = 0
print("If you want first chance write 1\n If you want second chance write 2")
i1 = int(input())
if i1 == 1:
while n<21:
print("Enter the number of digits uou wish to enter")
i2 = int(input())
for i in range(n+1,n+i2+1):
l.append(i)
print(l)
if 21 in l:
print("You lost")
break
n = max(l)
i3 = random.randint(1,4)
print("Computer wish to enter {} number of digits".format(i3))
for i in range(n+1,n+i3+1):
l.append(i)
print(l)
if 21 in l:
print("You won")
break
n = max(l)
elif i1 == 2:
while n<21:
i2 = random.randint(1,4)
print("Computer wish to enter {} number of digits".format(i2))
for i in range(n+1,n+1+i2):
l.append(i)
print(l)
if 21 in l:
print("You won")
break
n = max(l)