Normal text:
Here is the code:
x = 100 divisors = () for i in range(1,x): if x%i == 0: divisors = divisors + (i)
when the program starts, the following error appears:
divisors = divisors + (i) TypeError: can only concatenate tuple (not "int") to tuple
(1) not a tuple, its just an expression in brackets. To make it a tuple, add a trailing comma, (1,)
(1)
(1,)
Try using this instead:
divisors.append(i)
Edit:
divisors = []
since you cannot add tuples.
Source: https://habr.com/ru/post/895884/More articles:Delphi - finally, is the finally block guaranteed that the compiler will execute correctly? - exceptionNumber of rows in an ASP.NET GridView table using javascript - javascriptHow to make null secret key in java? - javaIs the DataMember attribute set to a field or property? - c #View source code from "Symbols Server" without debugging? - visual-studioSet DataContext to XAML - c #How to remove "Orders and Returns" from the footer? - magentoTable join in Oracle (several external joins) - sqlReal-time client in real time for delphi application. AS? - delphiHow can I get adjacent combination pairs using R? - rAll Articles