Can someone write a simple memory game program in python
Screenshot
-----------------------------------------
Program
#Packages for clear screen, sleep and random generation
import os
import time
import random
#Method to shows steps in the game print at start
def gameRule():
print("
WELCOME TO SIMPLE MEMORY GAME")
print("Rules\n------")
print("1. Look at the console you can see some
words in 1 seconds.Try to memorise")
print("2. Prompt for the specified position word
guess");
print("3. If same print win message , otherwise
lose message")
print("4. Do you want to guess again")
print("5. If yes start from step1
again\n")
#Main method
def main():
gameRule()
time.sleep(2)
# Read word randomly from the file
myWords =
open('C:/Users/deept/Desktop/w.txt').read().splitlines()
ch='Y'
#Loop until no
while(ch=='Y'):
#Print words
print("Memorizing
words:\n",myWords)
#Keep that 1
seconds
time.sleep(1)
#Clear screen
os.system('cls')
#Generate a
position
n=random.randint(0,len(myWords)-1)
#Prompt for guess
inpString='Enter the
'+str(n+1)+' position element in the list: '
guess=input(inpString)
#If same then win
message
if(guess==myWords[n]):
print ("Hurrai !!!!!!, you win")
#Otherwise loss
message
else:
print ("Better luck next time , you lose")
#Repeatation part
ch=input('Do you want to
continue(y/n): ')
ch=ch.upper()
#Error check
while(ch!='Y' and
ch!='N'):
print("ERROR!!!You should enter y/n.")
ch=input('Do you want to continue(y/n): ')
ch=ch.upper()
os.system('cls')
print(' Good Bye!!!')
#Starts here
main()
---------------------------------
WELCOME
TO SIMPLE MEMORY GAME
Rules
------
1. Look at the console you can see some words in 1 seconds.Try to
memorise
2. Prompt for the specified position word guess
3. If same print win message , otherwise lose message
4. Do you want to guess again
5. If yes start from step1 again
Enter the 4 position element in the list: Gippy
Hurrai !!!!!!, you win
Do you want to continue(y/n):
QUESTION 11 Python Write a python program determine the winning team in a football game. There are 4 quarters in a game (assuming no overtime). You can use Team A and Team B for the teams. Ask the user to enter the number of points scored in each quarter by each team. At the end, determine which team won. You should use a for or while loop for this program.
Can someone do this python program? Write a function that accepts a list of five numbers from a user and prints the length, sum, average, and largest number of the list.
Write a JAVA program that plays a simple Pac-man game. The game plays on a 10 by 10 grid (absolutely, you can make it bigger). Pac-man is depicted as “#” and others as “*”. Please see the below. You should ask how many pac-man plays before starting the game. Then, you should create the number of pac-man objects. The pac-mans are defined as classes, and the objects are stored in an array. The pac-man class has a “move()” method, which...
1. Use Turtle Graphics to create a tic tac toe game in Python. Write a Python program that allows for one player vs computer to play tic tac toe game, without using turtle.turtle
Simple Python Program Working with strings Write a Python program to read in a number of strings from the user. Stop when the user enters “Done”. Then check if each of the strings contains all the letters of the alphabet. Print the results in the form of a dictionary, where they keys are the strings and the values are the Truth Value for the string, which you just calculated. Sample Run: Enter the strings: taco cat The quick brown fox...
How to write a Python program to solve a simple payroll calculation? Calculate the amount of pay, given hours worked, and hourly rate.
USING A PYTHON Write a program that gives simple math quizzes. The program should display two random numbers that are to be added, such as: 247 + 129 The program should allow the student to enter the answer. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed.
Can someone please write the following program in Python please! 1) Define a function "converT()" that can take a file name, reads line by line to convert temperatures, and returns line by line. Each line in a file begins with a temperature in number {integer or floating point}, followed by one of the temperature unit {"F", "f", "C", "c"}. If "F" or "f", convert the temperature to Celsius. If "C" or "c", convert the temperature to Fahrenheit. The format of...
Python Simple Programming Write a program in Python that calculates the tip and total for a meal at a restaurant. When your program is run it should ... Calculate the tip and total for a meal for a restaurant Print the name of the application "Tip Calculator" Get input from the user for cost of meal and tip percent Print the tip and total amounts. The formula for calculating the tip amount is: tip = cost of meal * (tip...
Python Program
Python: Number Guessing Game Write a Python function called "Guess.py" to create a number guessing game: 1. Function has one input for the number to Guess and one output of the number of attempts needed to guess the value (assume input number will always be between 1 and 1000). 2. If no number was given when the function was called, use random.randint(a,b) to generate a random number between a=1 and b=1000. You will also need to add an...