Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
while True:
try:
entrada = int(input())
except:
break
if entrada == 0:
break
else:
vetor = [None] * entrada
aux = 1
for i in range(entrada):
vetor = []
k = 0
while k < entrada:
vetor.append(aux)
if aux == 4:
aux += 4
else:
aux += 2
k += 1
if aux == entrada:
vetor.append(aux)
aux = 4
k+=1
print('Discarded cards: ', end = ' ')
for j in range(len(vetor)):
if j == len(vetor)-1:
print('\nRemaining card: ', vetor[j])
elif j == len(vetor)-2:
print(vetor[j], end = '')
else:
print(vetor[j], end = ', ')
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more