Dec-10-2020, 11:16 AM
(This post was last modified: Dec-10-2020, 11:16 AM by interdisciplinary.)
Dear members,
Kindly I would like to inform you that I am working on a little project to automate a calculation process. The idea is that the program produces every second a value based on the previous value. An example would be 2, 4, 8, 16, 32 when a multiplication function is selected. I used a fictional line where steps can be made on.
The following code works with python 3.8 in the sense that it produces +1 values every second and starts with the selected value. However, I could not find on the internet how I might change the code so that it does what I would like it to do: 1) being able to select the step size (which should be a function) and 2) that the program ends with the selected value.
Does anyone know how to solve this issue or where I might forward my question?
Kindly I would like to inform you that I am working on a little project to automate a calculation process. The idea is that the program produces every second a value based on the previous value. An example would be 2, 4, 8, 16, 32 when a multiplication function is selected. I used a fictional line where steps can be made on.
The following code works with python 3.8 in the sense that it produces +1 values every second and starts with the selected value. However, I could not find on the internet how I might change the code so that it does what I would like it to do: 1) being able to select the step size (which should be a function) and 2) that the program ends with the selected value.
Does anyone know how to solve this issue or where I might forward my question?
import time start = 3 step = 5 end = 20 wait = 1 #waiting in seconds for i in range(end): i = i + step print(i) time.sleep(wait)