I would like pass the variables into the function that uses range(). How do I pass variable C that has more then one number via one variable. Something like range(5, 10, 2)?
Here is my example code:
a = 0
b = 10
c = 2
def num_count(a, b, c):
for number in range(c):
a += b
print("New Count is: {0}".format(a))
I tried passing it as a string and converting it to an integer as well as by using a list. Nothing worked.
c=(5,10,2)thenrange(*c)?rangeoutside the function and pass it in…? What's the best approach is very debatable with such artificial scenarios.range. See docs.python.org/3/tutorial/…