My Channel

Python Mini Game

 Python - Mini Fruit Game


This Fruit game is very simple to make and needs an import function.

So, Let me tell you what the game is about, it's pretty simple.

The computer randomly chooses a fruit from the list we have created at the first which will be in the code. This chosen fruit will not be printed but will be just stored. The main objective is to guess the fruit chosen by the computer.

So, here is the code,

import random

B = ["Apple","Banana","Citrus"]

print(B)

a = (random.choice(B))

c = input("Enter a fruit from the list:")

if c == a:

    print("Correct!")

else:

    print("Wrong! The answer is "+ a)


Hope you enjoyed today's program and will meet you sometime later with some more amazing Programs made in Python.

Until then, Bye!

By the Blog Author.

Post a Comment

0 Comments