Posts

Showing posts with the label games

Python Quiz Game

Source code of Quiz Game in Python scoreList = [] def gameKBC(n): """Answer the questions asked correctly and win money""" questionslist = ["What is the capital city of Pakistan?", "What programming language has the most user-friendly syntax?", "What is the chemical composition of water?", "Stars are mainly made of?", "How old is our universe?"] optionsList = [["Peshawar", "Karachi", "Lahore", "Islamabad"], ["python", "c++", "java", "lisp"], ["hydrogen", "oxygen", "hydrogen and oxygen", "nitrogen"], ["helium", "hydrogen", "iron", "chromium"], ["6000 years", "10,000 years", "1M years", ">

Guess The Number Game - You vs. Your Friend

Guess a Random Number Game import random print("\nWelcome to the Guess a random number Game!") print("Its a 2 player game.") print("The Winner is the one with the lowest attempts.\n") lower_limit = int(input("Plz choose the lower limit? ")) upper_limit = int(input("Plz choose the upper limit? ")) winner = [] for i in range(2): random_number = random.randint(lower_limit, upper_limit) print(f"\nIts player {i+1} turn:") guess_number = "" attempts = 0 while guess_number != random_number: attempts += 1 guess_number = int(input(f"Player {i+1}, Plz guess the number between {lower_limit} and {upper_limit}: ")) if guess_number < random_number: print("Plz choose higher number") elif guess_number > random_number: print("Plz choose lower number") else: print(f"Player {i+1}, You correctly

Building Snake Water Gun Game from scratch in Python - Free Source Code

Image
💓 ✋✋✋✋✋   💓 Hello, my dear ones! You can copy-paste the following code into your IDE and start playing the Snake Water Gun game instantly. Snake Water Gun Game Source Code import re def swg_game ( computer , You ):     if computer == You :         return None     elif computer == "s" :         if You == "g" :             return True         if You == "w" :             return False     elif computer == "w" :         if You == "s" :             return True         if You == "g" :             return False     elif computer == "g" :         if You == "w" :             return True         if You == "s" :             return False     import random from tkinter . messagebox import NO rNum = random . randint ( 1 , 3 ) if rNum == 1 :     computer = "s" elif rNum == 2 :     computer = "w" elif rNum == 3 :     computer = "g" print (

Building my first ever game in Python - Rock Scissor Paper Game

Image
Hi friends! ✋ ✋ ✋ Today I want to talk to you about my new achievement in the Python learning journey. I call it an achievement because it matters much to me as I am an absolute beginner in this computer science field.  Lately, I started watching some tutorials regarding Python learning. I am learning much from them and I will be sharing here with you guys also what I learn each day.  The notion of 'game creation' excites me tremendously. And just recently I learnt from the same tutorials how to build my first basic game. Games are fun to play now and then. But the idea of creating them is far more exciting (at least this is so in my mind).  This is what I learned today. I built my first ever game in Python. The game is called Rock Scissor Paper Game. It is a very simple and basic game. But the creation of it brought so much joy to me. Let me share the exact code with you people also. Following is The exact code that will create this Rock Scissor Paper Game is shared below. If