Nov-10-2019, 12:31 AM
>>> starting_weight = 225 >>> >>> def get_progress_value(current_weight): ... return starting_weight - current_weight ... >>> for current_weight in range(225, 217, -1): ... print(f"Current weight: {current_weight}, Progress bar value: {get_progress_value(current_weight)}") ... Current weight: 225, Progress bar value: 0 Current weight: 224, Progress bar value: 1 Current weight: 223, Progress bar value: 2 Current weight: 222, Progress bar value: 3 Current weight: 221, Progress bar value: 4 Current weight: 220, Progress bar value: 5 Current weight: 219, Progress bar value: 6 Current weight: 218, Progress bar value: 7 >>>