allIndex_A = [1, 2, 8, 12, 17, 21, 23, 29]
allIndex_B = [3, 5, 7, 9, 11, 13, 15, 18, 20, 22, 24, 26, 28, 30]
allIndex_C = [4, 6, 10, 14, 16, 19, 25, 27]
ita, itb, itc = iter(allIndex_A), iter(allIndex_B), iter(allIndex_C)
b = c = allIndex_A[0]
newList = []
try:
while True:
a = next(ita)
while b <= a:
b = next(itb)
while c <= a:
c = next(itc)
newList.append([a, b, c])
except StopIteration:
print(newList)
self.button = QtGui.QPushButton(u' поиск ',self)
- всё в порядке, стало быть, передself.listBox.addItem(f)
надо приводить f
к юникоду. return pass
?def f(**kwargs):
print(kwargs)
kwargs['a'] = 2
kwargs['b'] = 3
print(kwargs)
f(a=1)
var = random.choice(monetka)
var = 'орел'
import random
coin = ('head', 'tail')
heads = tails = count = 0
while True:
while True:
try:
times = int(input('Amount of coin toss?: '))
break
except ValueError:
print('Must be integer')
for i in range(times): # +скорость +однозначность
var = random.choice(coin)
count += 1
if var == 'head': # +наглядность +скорость
heads += 1
else:
tails += 1
print('Current results: head count = {0} ({1:%}), tail count = '
'{2} ({3:%})'.format(heads, heads / count, tails, tails / count))
while True:
new = input('Continue? y/n: ')
if new in ('y', 'n'):
break
else:
print('Print "y" or "n"')
if new == 'n':
break
print('Final results: head count = {0} ({1:%}), tail count = '
'{2} ({3:%})'.format(heads, heads / count, tails, tails / count))