0% found this document useful (0 votes)
12 views1 page

21 Ka Game

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

21 Ka Game

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

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)

print("Enter the number of digits uou wish to enter")


i3 = int(input())
for i in range(n+1,n+1+i3):
l.append(i)
if 21 in l:
print("You lost")
break
print(l)
n = max(l)

You might also like