Python 试图使计数器的输出乘以某个固定值
我试图制作一个计数器,它的输出乘以某个固定值;代码如下:Python 试图使计数器的输出乘以某个固定值,python,pygears,Python,Pygears,我试图制作一个计数器,它的输出乘以某个固定值;代码如下: from pygears.lib import qrange, mul qrange(10) | mul(2) 我得到的错误是: TypeMatchError: [0], Queue[Uint[4], 1] cannot be matched to Number - when matching Tuple[Uint[2], Queue[Uint[4], 1]] to Tuple[{'a': Number, 'b': Num
from pygears.lib import qrange, mul
qrange(10) | mul(2)
我得到的错误是:
TypeMatchError: [0], Queue[Uint[4], 1] cannot be matched to Number
- when matching Tuple[Uint[2], Queue[Uint[4], 1]] to Tuple[{'a': Number, 'b': Number}]
- when deducing type for argument "din"
- when instantiating "mul"
不确定pygears是什么,但您正在寻找: 将其输出乘以某个固定值的计数器 那么,给你:
# Choose your fixed value
fixed_value = 42
# Choose lower and upper bounds
left, right = 0, 5
# Multiply each index by fixed value
output_values = [i * fixed_value for i in range(left, right)]
print(output_values)
输出:[0,42,84,126,168]
这有用吗