Today’s Learning:
- Installed MySQL for database management.
- Solved The Minion Game challenge on HackerRank in Python.
1️⃣ Installing MySQL
MySQL is one of the most popular relational database management systems. Today, I learned how to install it on my system to start practicing SQL queries for Data Analytics.
Steps I followed:
- Downloaded MySQL Community Edition from the official MySQL website.
- Installed MySQL Server and MySQL Workbench.
- Configured root username and password.
- Verified the installation by running:
mysql --version
- Opened MySQL Workbench and successfully connected to my local server.
✅ Now I’m ready to write and execute SQL queries directly in MySQL Workbench.
2️⃣ HackerRank Challenge – The Minion Game 🐝
The Minion Game is a fun string-based game where two players, Kevin and Stuart, compete based on vowels and consonants in a given word.
Rules:
- Kevin gets points for substrings starting with vowels.
- Stuart gets points for substrings starting with consonants.
Python Solution:
def minion_game(string):
vowels = 'AEIOU'
kevin_score = 0
stuart_score = 0
length = len(string)
for i in range(length):
if string[i] in vowels:
kevin_score += length - i
else:
stuart_score += length - i
if kevin_score > stuart_score:
print("Kevin", kevin_score)
elif stuart_score > kevin_score:
print("Stuart", stuart_score)
else:
print("Draw")
# Example
minion_game("BANANA")
Step-by-step logic:
- Identify vowels – If the current letter is a vowel, Kevin gets points.
-
Points calculation – Number of substrings starting at position
i
islength - i
. - Score comparison – After looping, compare Kevin’s and Stuart’s scores.
Output for BANANA
:
Stuart 12
💡 Today’s Takeaway:
- Installing MySQL is the first step toward mastering databases in Data Analytics.
- String problems like the Minion Game help improve Python logic, which is essential for data processing.
Top comments (0)