Master the Art of Guessing: A Python Application for Social Media Enthusiasts project 14

Fun and Learning Combined: Building a 'Guess the Social Media Influencer' Game in Python

Master the Art of Guessing: A Python Application for Social Media Enthusiasts project 14


Introduction:

In today's digital age, social media influencers have gained significant popularity and influence. Have you ever wondered who has more followers between two well-known influencers? Look no further! With the "Guess the Social Media Influencer" Python application, you can put your knowledge to the test and challenge yourself in a fun and interactive way. In this article, we'll explore the key features of this project and how it can be a great addition to your programming portfolio.



Overview of the Application:


Describe the purpose and functionality of the "Guess the Social Media Influencer" application.

Mention the use of external libraries such as game_data, random, replit, and art for enhanced functionality and aesthetics.

Explain how the application randomly selects two social media influencers and presents them for comparison.

Gameplay Mechanics:


Detail how the application displays the information of the two influencers, including their names, descriptions, and countries.

Explain the scoring system, where users earn points for correctly identifying the influencer with more followers.

Discuss how the application generates new questions after each correct answer, ensuring a fresh and challenging experience.

Implementation Details:


Provide a high-level overview of the code structure and its main components.

Highlight key functions, such as show_question(), higher_value(), and the main game loop.

Explain how the code compares the follower counts and determines the correct answer.

User Experience and Visuals:


Emphasize the use of ASCII art through the art library to enhance the visual appeal of the application.

Mention the inclusion of the application's logo at the start and after each correct guess for branding and recognition.

Discuss how the application utilizes the replit library for clearing the terminal screen, providing a clean interface.

Conclusion and Future Enhancements:


Recap the article's main points and highlight the educational and entertainment value of the "Guess the Social Media Influencer" application.

Suggest potential future enhancements, such as adding a time limit for each question or incorporating multiple difficulty levels.

Encourage readers to try out the application, customize it, and explore further possibilities for expansion.

Replit link: https://replit.com/@safidullah1/higher-lower-start?v=1

Source code: 



from game_data import data
import random
from replit import clear
from art import logo,vs
print(logo)




question_1 = random.choice(data)
question_2 = random.choice(data)
if question_1 == question_2:
  question_2 =random.choice(data)
def show_question():
  print(f"\nCompare A: {question_1['name']}, a {question_1['description']}, from {question_1['country']}.\n{vs}\n")
  print(f"\nAgainst B: {question_2['name']}, a {question_2['description']}, from {question_2['country']}.\n\n")
show_question()
  

  
  
score = 0
A = int(question_1['follower_count'])
B = int(question_2['follower_count'])

def higher_value():
    """Just return the maximum value in the form of 'A' & 'B'"""
    if A > B:
      return 'A'
    else:
      return 'B'
stop_quize = False
  
while not stop_quize:
  if higher_value() == input(f"Who has more followers? Type 'A' or 'B':").upper():
    score += 1
    clear()
    print(logo)
    print(f"You're right! Current score: {score}.")
    question_1 = question_2
    question_2 = random.choice(data)
    A = int(question_1['follower_count'])
    B = int(question_2['follower_count'])
    
    show_question()
  else:
    stop_quize = True
    clear ()
    print(logo)
    print(f"Sorry, that's wrong. Final score: {score}")
  
#To do 1, generate two random question (dictionary) from data and assign to different variables. question_1, question_2.

#To-do 2, input from user about correct option.

#To-do 3, compare questions and spot the higher option and compare with user option.

#To-do 4, save scores for correct option, and continue quiz if user_option is correct.





# print(len(data))
# question_1 = random.choice(data)
# question_2 = random.choice(data)

# if question_1 == question_2:
#   question_2 = random.choice(data)
#   print(f"question 1 = {question_1}\n\n\n question 2 = {question_2}")
# else:
#   print(f"question 1 = {question_1}\n\n\n question 2 = {question_2}\n\n")

# for item in question_1:
#   print(question_1[item])

# print(f"\nCompare A: {question_1['name']}, a {question_1['description']}, from {question_1['country']}.\n\n")

# user_choice=input(f"Who has more followers? Type 'A' or 'B':")
/////////////////data file
data = [
    {
        'name': 'Instagram',
        'follower_count': 346,
        'description': 'Social media platform',
        'country': 'United States'
    },
    {
        'name': 'Cristiano Ronaldo',
        'follower_count': 215,
        'description': 'Footballer',
        'country': 'Portugal'
    },
    {
        'name': 'Ariana Grande',
        'follower_count': 183,
        'description': 'Musician and actress',
        'country': 'United States'
    },
    {
        'name': 'Dwayne Johnson',
        'follower_count': 181,
        'description': 'Actor and professional wrestler',
        'country': 'United States'
    },
    {
        'name': 'Selena Gomez',
        'follower_count': 174,
        'description': 'Musician and actress',
        'country': 'United States'
    },
    {
        'name': 'Kylie Jenner',
        'follower_count': 172,
        'description': 'Reality TV personality and businesswoman and Self-Made Billionaire',
        'country': 'United States'
    },
    {
        'name': 'Kim Kardashian',
        'follower_count': 167,
        'description': 'Reality TV personality and businesswoman',
        'country': 'United States'
    },
    {
        'name': 'Lionel Messi',
        'follower_count': 149,
        'description': 'Footballer',
        'country': 'Argentina'
    },
    {
        'name': 'Beyoncé',
        'follower_count': 145,
        'description': 'Musician',
        'country': 'United States'
    },
    {
        'name': 'Neymar',
        'follower_count': 138,
        'description': 'Footballer',
        'country': 'Brasil'
    },
    {
        'name': 'National Geographic',
        'follower_count': 135,
        'description': 'Magazine',
        'country': 'United States'
    },
    {
        'name': 'Justin Bieber',
        'follower_count': 133,
        'description': 'Musician',
        'country': 'Canada'
    },
    {
        'name': 'Taylor Swift',
        'follower_count': 131,
        'description': 'Musician',
        'country': 'United States'
    },
    {
        'name': 'Kendall Jenner',
        'follower_count': 127,
        'description': 'Reality TV personality and Model',
        'country': 'United States'
    },
    {
        'name': 'Jennifer Lopez',
        'follower_count': 119,
        'description': 'Musician and actress',
        'country': 'United States'
    },
    {
        'name': 'Nicki Minaj',
        'follower_count': 113,
        'description': 'Musician',
        'country': 'Trinidad and Tobago'
    },
    {
        'name': 'Nike',
        'follower_count': 109,
        'description': 'Sportswear multinational',
        'country': 'United States'
    },
    {
        'name': 'Khloé Kardashian',
        'follower_count': 108,
        'description': 'Reality TV personality and businesswoman',
        'country': 'United States'
    },
    {
        'name': 'Miley Cyrus',
        'follower_count': 107,
        'description': 'Musician and actress',
        'country': 'United States'
    },
    {
        'name': 'Katy Perry',
        'follower_count': 94,
        'description': 'Musician',
        'country': 'United States'
    },
    {
        'name': 'Kourtney Kardashian',
        'follower_count': 90,
        'description': 'Reality TV personality',
        'country': 'United States'
    },
    {
        'name': 'Kevin Hart',
        'follower_count': 89,
        'description': 'Comedian and actor',
        'country': 'United States'
    },
    {
        'name': 'Ellen DeGeneres',
        'follower_count': 87,
        'description': 'Comedian',
        'country': 'United States'
    },
    {
        'name': 'Real Madrid CF',
        'follower_count': 86,
        'description': 'Football club',
        'country': 'Spain'
    },
    {
        'name': 'FC Barcelona',
        'follower_count': 85,
        'description': 'Football club',
        'country': 'Spain'
    },
    {
        'name': 'Rihanna',
        'follower_count': 81,
        'description': 'Musician and businesswoman',
        'country': 'Barbados'
    },
    {
        'name': 'Demi Lovato',
        'follower_count': 80,
        'description': 'Musician and actress',
        'country': 'United States'
    },
    {
        'name': "Victoria's Secret",
        'follower_count': 69,
        'description': 'Lingerie brand',
        'country': 'United States'
    },
    {
        'name': 'Zendaya',
        'follower_count': 68,
        'description': 'Actress and musician',
        'country': 'United States'
    },
    {
        'name': 'Shakira',
        'follower_count': 66,
        'description': 'Musician',
        'country': 'Colombia'
    },
    {
        'name': 'Drake',
        'follower_count': 65,
        'description': 'Musician',
        'country': 'Canada'
    },
    {
        'name': 'Chris Brown',
        'follower_count': 64,
        'description': 'Musician',
        'country': 'United States'
    },
    {
        'name': 'LeBron James',
        'follower_count': 63,
        'description': 'Basketball player',
        'country': 'United States'
    },
    {
        'name': 'Vin Diesel',
        'follower_count': 62,
        'description': 'Actor',
        'country': 'United States'
    },
    {
        'name': 'Cardi B',
        'follower_count': 67,
        'description': 'Musician',
        'country': 'United States'
    },
    {
        'name': 'David Beckham',
        'follower_count': 82,
        'description': 'Footballer',
        'country': 'United Kingdom'
    },
    {
        'name': 'Billie Eilish',
        'follower_count': 61,
        'description': 'Musician',
        'country': 'United States'
    },
    {
        'name': 'Justin Timberlake',
        'follower_count': 59,
        'description': 'Musician and actor',
        'country': 'United States'
    },
    {
        'name': 'UEFA Champions League',
        'follower_count': 58,
        'description': 'Club football competition',
        'country': 'Europe'
    },
    {
        'name': 'NASA',
        'follower_count': 56,
        'description': 'Space agency',
        'country': 'United States'
    },
    {
        'name': 'Emma Watson',
        'follower_count': 56,
        'description': 'Actress',
        'country': 'United Kingdom'
    },
    {
        'name': 'Shawn Mendes',
        'follower_count': 57,
        'description': 'Musician',
        'country': 'Canada'
    },
    {
        'name': 'Virat Kohli',
        'follower_count': 55,
        'description': 'Cricketer',
        'country': 'India'
    },
    {
        'name': 'Gigi Hadid',
        'follower_count': 54,
        'description': 'Model',
        'country': 'United States'
    },
    {
        'name': 'Priyanka Chopra Jonas',
        'follower_count': 53,
        'description': 'Actress and musician',
        'country': 'India'
    },
    {
        'name': '9GAG',
        'follower_count': 52,
        'description': 'Social media platform',
        'country': 'China'
    },
    {
        'name': 'Ronaldinho',
        'follower_count': 51,
        'description': 'Footballer',
        'country': 'Brasil'
    },
    {
        'name': 'Maluma',
        'follower_count': 50,
        'description': 'Musician',
        'country': 'Colombia'
    },
    {
        'name': 'Camila Cabello',
        'follower_count': 49,
        'description': 'Musician',
        'country': 'Cuba'
    },
    {
        'name': 'NBA',
        'follower_count': 47,
        'description': 'Club Basketball Competition',
        'country': 'United States'
    }
]
////////////////////logo file
logo = """
    __  ___       __             
   / / / (_)___ _/ /_  ___  _____
  / /_/ / / __ `/ __ \/ _ \/ ___/
 / __  / / /_/ / / / /  __/ /    
/_/ ///_/\__, /_/ /_/\___/_/     
   / /  /____/_      _____  _____
  / /   / __ \ | /| / / _ \/ ___/
 / /___/ /_/ / |/ |/ /  __/ /    
/_____/\____/|__/|__/\___/_/     
"""

vs = """
 _    __    
| |  / /____
| | / / ___/
| |/ (__  ) 
|___/____(_)
"""


Next Post Previous Post