00:02
We need to rewrite the python program with the following characteristics.
00:07
First, we prompt the user for a string that contains two strings separated by a comma.
00:15
Then the second characteristic is that we have to report an error if the input string does not contain a comma.
00:27
Continue to prompt the user until a valid string is entered.
00:33
If the input contains a comma, then a input contains a comma, then a that the input contains the two strings.
00:40
Third characteristic, using string splitting, extract two words from the input string and then remove any spaces and output the two words.
00:51
Anipar 4 or number 4.
00:54
Using a loop, extend the program to handle multiple lines of input.
01:01
Continue until the user enters q, the letter q, to quit.
01:05
And here we have a solution to this problem and we see is a small solution, it's a compact solution to the problem.
01:23
And the first thing we do here is to input from the user using the input function, and then at the same time we put the message, enter input string.
01:38
So the user knows what must be done, that is enter, string and then we remove spaces from the leading part of the string that is in front the first characters that are equal to spaces and the trailing spaces also that is storing a variable string data and then we do the loop in this case is an infinite loop while true because the condition true is always true of course and it means inside this loop we can have an instruction that stops a loop and we'll see what is that so the first thing we check is if this string is the letter q not for do the same action if we is the user entered as capital or uppercase q or lowercase q we lower the string data and compare to the lower q that is lower the information in the string just to compare with the small or lower case q.
03:08
If that's true we print by on the screen and then break the loop.
03:15
Remember this break is breaking the loop or it is contained in this case the on the loop we have here is while true and if we break this loop we go just to the end of the program because there is no other instruction after the while a loop so this break acts in this case as if it's stopping or finishing the execution of the program but what is true is that the break is sending the control of the execution of the program to the line after the while through.
04:00
But because there is no other instruction after that while loop, then the program stops.
04:09
So that's the first thing we check to see if the user is entering the letter q to stop the problem or to create the program...