Problem: You are tasked with implementing a program that does a couple of things that will test your knowledge regarding while loops, for loops, and infinite loop conditions! The program will do all the following:
- Ask for an input that will be a positive, non-zero number in the range of [2, ∞). Indicate that, by entering -1, the user can exit the program. Ensure to have a check in place to determine if the input is -1, and to have a way to exit the program. If an entered number is out of range, indicate that it is invalid, and have the program start back from the beginning during runtime, meaning the program should not end and be run again.
- When exiting the program, print out the number of times the user has entered numbers. Again, it must NOT include the entering of the exit condition.
- Have a counter that keeps track of the number of times the user has entered a
number, not including the exit condition of -1. However, the counter WILL be keeping track of all other numbers, valid or invalid.
- If the entered number is valid, calculate and print the first five powers of that number. This must be implemented iteratively (i.e. through a for loop), and the use of the exponential math operator (**) is allowed.
All of that MUST be done within an infinite loop condition. In class, an infinite loop was demonstrated using a while loop. There are other ways of implementing an infinite loop condition as well, so do keep that in mind on approaching this assignment. Additionally, be mindful of edge test cases as well.
Output: Invalid input!
32 Input: 1
Output: Invalid input! Input: -1
Output: The user has entered 2 numbers!
Notes: Save your files as “firstname_lastname_loops.py”..