Question
Please continue the code for the 4 5 6 parts. Thanks! You may not use any collection (such as a list, tuple, or dictionary) in
Please continue the code for the 4 5 6 parts. Thanks!
You may not use any collection (such as a list, tuple, or dictionary) in your program.
Examples:
154152 can be split evenly into three-digit pieces (154, 152) not increasing order
154152 cannot be split evenly into five-digit pieces
173 can be split evenly into one-digit pieces (1, 7, 3) not increasing order
173 can be split evenly into three-digit pieces (173) increasing order
173 cannot be split evenly into two-digit pieces
Design, implement and test a Python program that checks to see if a user-supplied whole number can be split evenly into pieces that are in numerically increasing order.
1.The program will prompt the user to enter a whole number. If the user enters an invalid input (anything other than a whole number), the program will repeatedly prompt the user until a valid input is entered.
2.The program will then prompt the user to enter the number of digits in each piece. The program will verify that the input is valid (a whole number which is a proper divisor of the number of digits in the first input); if the input is invalid, the program will repeatedly prompt the user until a valid input is entered.
3.The program will split the number into pieces and display those pieces on one line (separated by commas).
4.The program will report whether or not the pieces are in numerically increasing order. If there is only one piece, it is defined to be in numerically increasing order.
5.The program will keep track of "scores", i.e., the number of times that the pieces are in numerically increasing order or decreasing order. Once the score reaches 5 numerically increasing sequences, the "game" tells the user that they won and ends.
6. Another "score" variable you track for "losing" the game after 5 decreasing sequences.
plit = ' ount =0 or i in range(len(num)): split += num [i] count +=1 if count == digit: printsplit=1lit,end=1)count=0ifi=len(num)1:print(1,1,end=1)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started