def kareler(x:int,y:int):
toplam=0
for i in range(x,y):
toplam+=i**2
return toplam
def tkareler(x:int,y:int):
toplam1=0
for i in range(x,y):
toplam1+=i
return toplam1**2
sayi1=print(kareler(1,11))
sayi2=print(tkareler(1,11))
print("Gerekli sayi",sayi2-sayi1) # TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'
if type(sayi1)==None:
sayi1=int(sayi1)
print(sayi1) # this even not give any result to me
您好,我得到了2个结果385和3025,但当我想减去这两个结果时,我得到了一个错误,我如何才能将none类型转换为integer
无法从
None
中获取int值。相反,使用从函数中获得的int值。更改此项:为此:
print
函数返回None
,而不是您让它打印的东西相关问题 更多 >
编程相关推荐