Question: Write a program to display a value starting at 1 which has been incremented a specified number of times. Ask the user how many numbers

Write a program to display a value starting at 1 which has been incremented a specified number of times.
Ask the user how many numbers they would like displayed. Validate the input and if they have entered a positive non zero integer then ask the user what the increment value should be. Validate the input and if they have entered a positive non zero integer for the increment value then display that many numbers starting from 1. The counter and value both start at 1.
If they did not enter positive non zero integers for either of the values, inform them as per the examples below.
Hints.
Ensure you handle any spaces entered as part of the input.
Notice how you can't increment in steps of 0.
Notice that 'Bye.' is displayed only if the values were able to be displayed.
The solution is between 20(making use of enumerate) and 22 lines of code.
The solution does not use a nested loop.
Not all the test data used is shown.
For example:
Input Result
10
two
Please enter how many numbers you would like displayed: 10
Please enter the increment value: two
Positive non zero integers only.
ten
Please enter how many numbers you would like displayed: ten
Positive non zero integers only.
5
0
Please enter how many numbers you would like displayed: 5
Please enter the increment value: 0
The increment value needs to be >0.
5
1
Please enter how many numbers you would like displayed: 5
Please enter the increment value: 1
Counter: 1 value: 1
Counter: 2 value: 2
Counter: 3 value: 3
Counter: 4 value: 4
Counter: 5 value: 5
Bye.
6
-1
Please enter how many numbers you would like displayed: 6
Please enter the increment value: -1
Positive non zero integers only.
12
3
Please enter how many numbers you would like displayed: 12
Please enter the increment value: 3
Counter: 1 value: 1
Counter: 2 value: 4
Counter: 3 value: 7
Counter: 4 value: 10
Counter: 5 value: 13
Counter: 6 value: 16
Counter: 7 value: 19
Counter: 8 value: 22
Counter: 9 value: 25
Counter: 10 value: 28
Counter: 11 value: 31
Counter: 12 value: 34
Bye.
0
Please enter how many numbers you would like displayed: 0
There is nothing to count.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!