In this article we will see how we can create a flames calculator using PyQt5. This flames calculator assesses and predicts the outcome of a relationship based on an algorithm of two given names.
FLAMES is a popular game named after the acronym: Friends, Lovers, Affectionate, Marriage, Enemies, Sibling. This game does not accurately predict whether or not an individual is right for you, but it can be fun to play this with your friends.
Below is how the flames calculator will look like
GUI implementation steps :
1. Create a label that says enter player 1 name and set color and geometry to it
2. Add QLineEdit widget in front of the first name label to get the first name
3. Similarly create another label that says enter player 2 name and set color and geometry to it
4. Add QLineEdit widget in front of this label to get the second name
5. Create a label to show the result and set its border, geometry and change its font.
6. Create a push button at the bottom which says get result.
Back end implementation steps :
1. Add action to the push button
2. Inside the push button action get both player names
3. Remove the spacing in between the names
4. Call the get result method that returns the result
5. Inside the get result method call the remove letter method that removes the common characters with their respective common occurrences.
6. Then get the count of characters that are left and take FLAMES letters as [“F”, “L”, “A”, “M”, “E”, “S”]
7. Start removing letter using the count we got. The letter which last the process is the result, return the result
8. Set the result to the label using setText method.
Below is the implementation
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.