Question

In: Computer Science

Python3 Write a program to implement the Pokemon game should ask the user to enter their...

Python3

Write a program to implement the Pokemon game should ask the user to enter their type and compare it with a randomly chosen computer type and correctly display who wins/ties.

Solutions

Expert Solution

Thanks for the question.
Below is the code you will be needing  Let me know if you have any doubts or if you need anything to change.
Thank You !!
===========================================================================
import random
def getComputerChoice():
    choices=['Fire','Grass','Water']
    return random.choice(choices)


def getWinner(userChoice, computerChoice):
    userChoice=userChoice.title()
    if userChoice==computerChoice:
        return 'Its a Draw!'
    if userChoice=='Fire' and computerChoice=='Grass':
        return 'You win!'
    if userChoice=='Grass' and computerChoice=='Water':
        return 'You win!'
    if userChoice=='Water' and computerChoice=='Fire':
        return 'You win!'
    if computerChoice=='Fire' and userChoice=='Grass':
        return 'Computer wins!'
    if computerChoice=='Grass' and userChoice=='Water':
        return 'Computer wins!'
    if computerChoice=='Water' and userChoice=='Fire':
        return 'Computer wins!'
    return 'Invalid Selection!'


def main():
    print('Welcome to Pokemon Game')
    user = input('Enter a type (fire/grass/water): ')
    computer=getComputerChoice()
    print('You choose: {} Computer choose: {}'.format(user.title(),computer))
    winner = getWinner(user,computer)
    print(winner)

main()






===========================================================================


Thank you so much ! 

Please do appreciate with an up vote : )


Related Solutions

Write a program that will ask the user to enter the amount of a purchase. The...
Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax. Assume the state sales tax is 5 percent and the county sales tax is 2.5 percent. The program should display the amount of the purchase, the state sales tax, the county sales tax, the total sales tax, and the total of the sale (which is the sum of the amount of purchase plus the...
1. Write a program that will ask the user to enter a character and then classify...
1. Write a program that will ask the user to enter a character and then classify the character as one of the following using only IF-ELSE and logical operators. (50 points - 10pts for syntax, 10pts for commenting and 30pts for successful execution) • Integer • Lower Case Vowel • Upper Case Vowel • Lower Case Consonant • Upper Case Consonant • Special Character
Write a program that does the following. It will ask the user to enter an integer...
Write a program that does the following. It will ask the user to enter an integer larger than 1, and the if entered integer is not larger than 1, it keeps prompting the user. After the user enters a valid integer, the program prints all the prime factors of the integer (including the repeated factors). For example, if the entered integer is 24, the program prints: 2 2 2 3 Run your program with the test cases where the entered...
Write a program in MIPS Assembly. This program will ask the user to enter 20 numbers....
Write a program in MIPS Assembly. This program will ask the user to enter 20 numbers. The program will store these numbers in an array in memory (sequential memory locations). It will then print out the list of numbers in three different formats: The numbers will be printed each on a separate line. The numbers will be printed on a single line, with spaces between the numbers. The program will ask the user to enter a number n. The program...
write a program i java that ask the user to enter salary, user ID and username...
write a program i java that ask the user to enter salary, user ID and username and out put them
Write a MIPS program that will ask the user to enter two numbers at the console...
Write a MIPS program that will ask the user to enter two numbers at the console and pass the values to a function that does multiplication
Write the following program in Java. Ask the user to enter the number of rows and...
Write the following program in Java. Ask the user to enter the number of rows and columns for a 2-D array. Create the array and fill it with random integers using (int)(Math.random() * 20) (or whatever number you choose). Then, provide the user with several menu choices. 1. See the entire array. 2. See a specific row. 3. See a specific column. 4. See a specific value. 5. Calculate the average of each row. 6. Calculate the total of each...
Write a MIPS program that will ask the user to enter two numbers at the console...
Write a MIPS program that will ask the user to enter two numbers at the console and compute xy
Write a python program that will ask the user to enter any number of days. The...
Write a python program that will ask the user to enter any number of days. The program reads the number of days from the user, and returns how many years, months, and days are there in the given number of days. Your program should prompt the user to: Enter the number of days : 1152 The user types number of days (1152 above, for example) and hit enter key. The program then will print: 3 years 1 months 27 days...
Write a python program that will ask the user to enter as many positive and negative...
Write a python program that will ask the user to enter as many positive and negative numbers and this process will only stop when the last number entered is -999. Use a while loop for this purpose. Your program should compute three sums; the sum of all numbers, sum of all positive numbers, and the sum of all negative numbers and display them. It should also display the count of all numbers, count of all positive numbers, and count of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT