Professional Documents
Culture Documents
App - Python
App - Python
FLIPPING TILES
MEMBER
S
● The provided P ython code implements a memory game using an SQLite database.
This memory game challenges the player to find matching pairs of t iles on a game
board. The code manages the game's logic, including shuffling t iles, t racking t ile flips, and
determining when pairs are matched. SQLite is used to store the state of the
game, and the player interacts with the game through the console.
OBJECTIV
E
1.Educational P urpose: To educate individu als, students, or professionals about the features, benefits,
and effective use of the LinkedIn app as a professional networking tool.
2.Skill Develop m ent: To help individu als develop essential skills for creating and m anaging a
professional online presence, including optim izing their LinkedIn profiles,
networking, and personal branding.
3.Career Develop m ent: To assist job seekers in using the LinkedIn app as an effective platform for job
searching, connecting with potential em ployers, and exploring career
opportunities.
4. Entrepreneurship: To guide aspiring entrepreneurs on how to lever age LinkedIn for
building a business network, prom oting their startups, and seeking investm ent opportunities.
WORKING
OF THE
CODE
1.It imports the 'sqlite3 module for working with SQLite databases
and the 'random module for shuffling the t iles. 6. The main() function in it ializes variables to keep t rack of
the number of pairs found and the number of attempts made. It enters
2. The code establishes a connection to an SQL0te database a loop that continues until all 8 pairs are found.
named memory_game.db and creates a cursor for executing SQL
commands on the database. 7.Inside the loop, the current state of the game board is displayed
using the display_board() function.
3. It defines a table named t iles' with three columns: id (an
in teger primary key), 'value (to store the letter associated with 8.The player is prompted to enter two t ile numbers (1-16) to flip. The
each t ile), and flipped (an in teger to indicate if the t ile has been code handles in valid inputs and continues to prompt until valid t ile
flipped, with a default value of o). numbers are entered.
4.The game in it ializes an array t iles containing pairs of letters from 9.It retrieves information about the selected t iles from the database,
'A’ to 'H (for a total of 16 t iles), shuffles them randomly, including their IDs, values, and whether they are already flipped.
and
inserts them into the tiles' table in the database. Each tile is assigned 10.If the selected t iles form a valid match (i.e., they have the same
a unique ID. value and both are not already flipped), the code
updates the 'flipped' column in the database to indicate that these t
5. The 'display_board()' function retrieves the current state of iles have been flipped, increments the 'pairs_found' count, and prints
the t iles from the database and displays them. Flipped t iles are shown a "Match found!" message.
with their values, and unflipped t iles are displayed as
question marks. The board is displayed in a 4x4 grid.
WORKING
OF THE
CODE
-11. If the selected tiles do not form a match, a "No match. Try again." message is displayed.
13. The game loop continues until all 8 pairs are found, at which point it displays a congratulatory message along with the n umb er
attempts made to complete the game. of