SLC S21 Week4 || Mastering String Manipulation and Operations in Python
Assalamualaikum my fellows I hope you will be fine by the grace of Allah. Today I am going to participate in the steemit learning challenge season 21 week 4 by @kouba01 under the umbrella of steemit team. It is about Advanced String Manipulation with Python and Qt Designer. Let us start exploring this week's teaching course.
Task 1 - Intersection of two chains
According to the requirement of the task 1 to develop an application to find the intersection between the chains I have added the following things in the GUI.
A label at the top to display the name and the next label to represent ch1 and another label to represent ch2 for the user. They will make the user interface easy to understand. Then there is the label to display the output and the other information about the errors.
I have added 2 input fields to get input from the user. First input will be used to get input from the user for the variable ch1 and the other will be used to get the input from the for the variable ch2.
There are two buttons in the application to perform the operations. One button is Form to get the intersection between the entered chains. The other button Erase is to clear all the input fields and the output.
First of all I have imported the GUI intersection_chains.ui
whcih I created in the Designer. The application is running without any error. You can see that when I am giving two strings and clicking on the Form button it is displaying the intersection between these strings.
But before this it is checking the input and valiadting it and if it meets all the codnitions then it proceeds the intersection application and finds intersection between the chains otherwise it is showing errors on the screen while informing which type of error is happening. It validates the input by the following this criteria:
- Check if both strings are non-empty.
- Validate the string to ensure it contains only lowercase letters and is of valid length. And the valid length condition is
1 <= len(string) <= 30
.
If the input breaches these conditions then it will display the relevant error on the screen.
So we can use this application to find the intersection between the strings but we need to keep in mind the criteria while giving the input.
Task 2 - Word mirrors
According to the requirement of the task 2 to develop an application to find the word mirror or reverse of the words I have added the following things in the GUI.
A label at the top to display the name and the next label to represent Enter a string. Then there is the label to display the output and the other information about the errors and warnings.
I have added 1 input field to get input from the user. The input field will be used to get string from the user. Then this string will be reversed.
There are two buttons in the application to perform the operations. One button is Mirror to reverse the entered string. The other button Erase is to clear the input field and the output.
First of all I have imported the GUI word_mirrors.ui
whcih I created in the Designer. The application is running without any error. You can see that when I am giving a string and clicking on the Mirror button it is reversing the string and displaying it in the output section.
But before this it is checking the input and valiadting it and if it meets all the codnitions then it proceeds the application and reverses the string otherwise it is showing errors on the screen while informing which type of error is happening. It validates the input by the following this criteria:
- Input must be between 1 and 50 characters.
- Input cannot start or end with a space.
- Between two words only one space is allowed.
- Input must contain only lowercase alphabetic characters and spaces.
If the input breaches these conditions then it will display the relevant error on the screen.
So we can use this application to rerverse the string but we need to keep in mind the criteria while giving the input.
Task 3 - Rotation Mirror
According to the requirement of the task 3 to develop an application to find the word rotation mirror or encrypting the words and then reversing them and displaying them I have added the following things in the GUI.
A label at the top to display the name and the next label to represent Enter a string. Then there is the label to display the output and the other information about the errors and warnings.
I have added 1 input field to get input from the user. The input field will be used to get string from the user. Then this string will be and encrypted and will be reversed.
There are two buttons in the application to perform the operations. One button is Verify to encrypt the string and then reverse it. The other button Erase is used to clear the input field and the output.
First of all I have imported the GUI rotation_mirror.ui
whcih I created in the Designer. The application is running without any error. You can see that when I am giving a string and clicking on the Verify button it is encrypting the string and reversing the string and displaying it in the output section.
But before this it is checking the input and valiadting it and if it meets all the codnitions then it proceeds the application and encrypts and reverses the string otherwise it is showing errors on the screen while informing which type of error is happening. It validates the input by the following this criteria:
- Input must be between 1 and 9 characters.
- Input must contain only lowercase alphabetic characters.
If the input breaches these conditions then it will display the relevant error on the screen.
So we can use this application to encrypt and rerverse the string but we need to keep in mind the criteria while giving the input.
Task 4 - Perfect Succession
According to the requirement of the task 4 to develop an application to find the perfect succession of the two numbers and then displaying it on the screen I have added the following things in the GUI.
A label at the top to display the name and the next label to represent Enter a string. Then there is the label to display the output and the other information about the errors and warnings.
I have added 2 input fields to get input from the user. First input will be used to get input from the user for the variable M and the other will be used to get the input from the for the variable N.
There are two buttons in the application to perform the operations. One button is Verify to arrange the digits and to check if they form perfect succession or not. The other button Erase is used to clear the input field and the output.
First of all I have imported the GUI perfect_succession.ui
whcih I created in the Designer. The application is running without any error. You can see that when I am giving two numbers M and N and clicking on the Verify button it is arranging the digits in the ascending order or you can say sorting the digits from small to large and then it is chceking if their arrangment is forming a perfect succession or not. And then the relevant output is being displayed on teh screen.
But before this it is checking the input and valiadting it and if it meets all the codnitions then it proceeds the application and sorts and finds perfect succession otherwise it is showing errors on the screen while informing which type of error is happening. It validates the input by the following this criteria:
- Both inputs must be positive integers.
If the input breaches this condition then it will display the relevant error on the screen.
So we can use this application to sort and find the perfect succession but we need to keep in mind the criteria while giving the input.
Task 5 - Words Sorting
According to the requirement of the task 5 to develop an application to sort the words by length I have added the following things in the GUI.
A label at the top to display the name and the next label to represent Enter a string. Then there is the label to display the output and the other information about the instructions, errors and warnings.
I have added 1 input field to get input from the user. The input field will be used to get string from the user. Then this string will be splitted into parts and the period will be removed before splittion and then it will be sorted. After the sorting the period will be added and the new modified string will be returned where the words will be sorted by length.
There are two buttons in the application to perform the operations. One button is Sort to perform the major operation of this application to split, sort and return the string. The other button Erase is used to clear the input field and the output.
First of all I have imported the GUI word_sorting.ui
whcih I created in the Designer. The application is running without any error. You can see that when I am giving a string and clicking on the Sort button it is displaying the sorted string by length.
But before this it is checking the input and valiadting it and if it meets all the codnitions then it proceeds the sorting application and sorts the string otherwise it is showing errors on the screen while informing which type of error is happening. It validates the input by the following this criteria:
- Input cannot be empty.
- The string must start with a letter.
- The sentence must end with a dot.
- Between two words only one space is allowed.
- The sentence must not exceed 15 words.
If the input breaches these conditions then it will display the relevant error on the screen.
So we can use this application to sort the words by lentgh but we need to keep in mind the criteria while giving the input.
I invite @wilmer1988, @josepha, @ripon0630 to join this learning challenge.
You've got a free upvote from witness fuli.
Peace & Love!
Congratulations, your post has been upvoted by @scilwa, which is a curating account for @R2cornell's Discord Community. We can also be found on our hive community & peakd as well as on my Discord Server
Felicitaciones, su publication ha sido votado por @scilwa. También puedo ser encontrado en nuestra comunidad de colmena y Peakd así como en mi servidor de discordia