# Top 7 python computer science project ideas for 11th & 12th classes

## Its Importance

The greatest thing you can do as a Python beginner is to work on some practical Python project ideas. It will help you in various other aspects like boosting confidence, testing your programming skills, and improving them. While operating on a Python project, you will need to familiarise yourself with new technologies and tools.

The more you know about cutting-edge development environments, libraries, and tools, the more options you’ll have for experimenting with your projects. You gain knowledge by experimenting with various Python project ideas more and more.

We’ll look at the top 7 python computer science project ideas for 11th & 12th classes that beginners can use to put their skills to the test.

### 1. Number Guessing

Beginners will particularly benefit from this project. Create a program that allows the computer to select a number at random from 1 to 10, 1 to 100, or any other range. Give users a hint so they can determine the number. Each incorrect guess results in a point deduction for the user. Multiples, divisions, greater or smaller numbers, or any combination of these, could be the clue.

Here’s the Source Code.

#importing the librariesimport randomimport math

#intro sectionprint("""hello!!!this is a guessing game.please enter your bound for the game to start""")

#getting the inputslower = int(input("Enter Lower bound:- "))upper = int(input("Enter Upper bound:- "))

#generating the random number between the chosen boundx = random.randint(lower, upper)print("\n\tYou've only ",round(math.log(upper - lower + 1, 2))," chances to guess the integer!\n")

#Initializing the number of guesses.guess_count = 0

#while loop for each round of the gamewhile guess_count < math.log(upper - lower + 1, 2):guess_count += 1

 #taking guessing number as inputguess = int(input("Guess a number:- "))

#Condition testingif x == guess:print("Congratulations you did it in ",guess_count, " try")#Once guessed, loop will breakbreakelif x > guess:print("You guessed too small!")print("You have ", round(math.log(upper - lower + 1, 2)) -guess_count, " guess left")elif x < guess:print("You Guessed too high!")print("You have ", round(math.log(upper - lower + 1, 2)) -guess_count, " guess left")

#If you guessed more than your chances the game will endif guess_count >= math.log(upper - lower + 1, 2):print("\nThe number is %d" % x)print("\tBetter Luck Next time!")

### 2. Dice Rolling Simulator

As the name of the programme suggests, we will simulate rolling dice. One of the fascinating Python projects will generate a random number every time the programme rolls the dice, and the user can do this as many times as he wants. The computer programme will generate a random number between 1 and 6 when the user rolls the dice.

Here’s the Source Code.
import random

start = input('Please press ENTER to roll the dice.')

def dice():dice = random.randint(1,6)return dice

print('The number rolled is ',dice(),'.')
while True:roll_again = input('Would you like to roll again? Y/N ')

if roll_again.lower()=="y":print('The new number rolled is ',dice(),'.')else:print('Thanks for playing.')break

### 3. Hangman

This is more of a word-guessing game. You’ll need to use the following basic concepts when creating this project: Variables, Irregular, Integer, Strings, Char and Output, and Boolean. Users have to guess the letters in the game, and each user has a certain number of tries available.

Here’s the Source Code

#!/usr/bin/python3#Hangman game

import random

class HangMan(object):

 # Hangman gamehang = []hang.append(' +---+')hang.append(' | |')

 hang.append(' |')hang.append(' |')hang.append(' |')hang.append(' |')hang.append('=======')

 man = {}man[0] = [' 0 |']man[1] = [' 0 |', ' | |']man[2] = [' 0 |', '/| |']man[3] = [' 0 |', '/|\ |']man[4] = [' 0 |', '/|\ |', '/ |']man[5] = [' 0 |', '/|\ |', '/ \ |']

 pics = []

 words = '''ant baboon badger bat bear beaver camel cat clam cobra cougar coyotecrow deer dog donkey duck eagle ferret fox frog goat goose hawk lion lizard llamamole monkey moose mouse mule newt otter owl panda parrot pigeon python rabbit ramrat raven rhino salmon seal shark sheep skunk sloth snake spider stork swan tigertoad trout turkey turtle weasel whale wolf wombat zebra'''.split()

 infStr='_-*\'*-_-*\'*-_-*\'*-_-*\'*-_-*\'*-_-*\'*-_-*\'*-_-*\'*-_-*\'*-_-*\''

 def init(self, *args, **kwargs):i, j = 2, 0self.pics.append(self.hang[:])for ls in self.man.values():pic, j = self.hang[:], 0for m in ls:pic[i + j] = mj += 1self.pics.append(pic)

def pickWord(self):return self.words[random.randint(0, len(self.words) - 1)]
def printPic(self, idx, wordLen):for line in self.pics[idx]:print(line)

 def askAndEvaluate(self, word, result, missed):guess = input()

 if guess == None or len(guess) != 1 or (guess in result) or (guess in missed):return None, Falsei = 0right = guess in wordfor c in word:if c == guess:result[i] = ci += 1return guess, right

 def info(self, info):ln=len(self.infStr)print(self.infStr[:-3])print(info)print(self.infStr[3:])

 def start(self):print('Welcome to Hangman !')word = list(self.pickWord())result = list('*' * len(word))print('The word is: ', result)success, i, missed = False, 0, []while i < len(self.pics)-1:print('Guess the word: ', end='')guess,right = self.askAndEvaluate(word, result, missed)if guess == None:print('You\'ve already entered this character.')continueprint(''.join(result))if result == word:self.info('Congratulations ! You\'ve just saved a life !')success = Truebreakif not right:missed.append(guess)i+=1self.printPic(i, len(word))print('Missed characters: ', missed)

if not success:self.info('The word was \''+''.join(word)+'\' ! You\'ve just killed a man, yo !')
a = HangMan().start()

### 4. Calculator

Although a calculator isn’t very useful, creating your own graphical UI calculator will help you become more accustomed to a library like Tkinter where you can create buttons to perform various operations and display outcomes on a screen.

Here’s the Source Code.

#Author:#Agyeya Mishra#Department of Civil Engineering#Delhi Technological University (formerly, Delhi College of Engineering)#New Delhi, India

#Python program to create a simple calculator

#Function to perform addition of two numbersdef add(number1, number2):return (number1 + number2)

#Function to perform subtraction of two numbersdef subtract(number1, number2):return (number1 - number2)

#Function to perform multiplication of two numbersdef multiply(number1, number2):return (number1 * number2)

#Function to perform division of two numbersdef divide(number1, number2):return (number1 / number2)

print("Operation Menu -\n" \"1. Addition of two numbers\n" \"2. Subtraction of two numbers\n" \"3. Multiplication of two numbers\n" \"4. Division of two numbers\n")

#Taking input from the userselect = input("Select operations form 1, 2, 3, 4 :")

num1 = int(input("Enter first number: "))

num2 = int(input("Enter second number: "))

if select == '1':print(num1, "+", numb2, "=",add(num1, num2))

elif select == '2':print(num1, "-", num2, "=",subtract(num1, num2))

elif select == '3':print(num1, "*", num2, "=",multiply(num1, num2))

elif select == '4':print(num1, "/", num2, "=",divide(num1, num2))else:print("Invalid input!"

### 5. Tic-Tac-Toe

One of the most innovative Python project concepts is this concept.
A “O” will be placed in any square by the second player, while a “X” will be placed in any square by the first player. The winner lines up three consecutive Xs or Os on the grid.
The Pygame library can be used to build this project. All the modules required for computer graphics and sound are included in Pygame.

Here’s the Source Code

import pygameimport timeimport randomfrom pygame.locals import *from utils import *from buttons import *import ai

pygame.init()

game_mode = 0

class Board:

 scores = {'X': 0, '0': 0, 'tie': 0}player = 'X'

def init(self):self.font = pygame.font.SysFont("comicsansms",20)pygame.display.set_caption("Tic Tac Toe")

def reset(self):w = .6 * game_wh = .6 * game_hself.board = pygame.Surface((w, h))#verticalpygame.draw.line(self.board, white, [w/3, 0], [w/3, h], 5)pygame.draw.line(self.board, white, [2w/3, 0], [2w/3, h], 5)#horizontalpygame.draw.line(self.board, white, [0, h/3], [w, h/3], 5)pygame.draw.line(self.board, white, [0, 2h/3], [w, 2h/3], 5)self.grid = [[None, None, None], [None, None, None], [None, None, None]]self.text = self.font.render("Player X: %d Player O: %d Ties: %d" % (self.scores['X'], self.scores['0'], self.scores['tie']), True, white)self.player = 'X'self.remaining = 9

def reset(self):w = .6 * game_wh = .6 * game_hself.board = pygame.Surface((w, h))#verticalpygame.draw.line(self.board, white, [w/3, 0], [w/3, h], 5)pygame.draw.line(self.board, white, [2w/3, 0], [2w/3, h], 5)#horizontalpygame.draw.line(self.board, white, [0, h/3], [w, h/3], 5)pygame.draw.line(self.board, white, [0, 2h/3], [w, 2h/3], 5)self.grid = [[None, None, None], [None, None, None], [None, None, None]]self.text = self.font.render("Player X: %d Player O: %d Ties: %d" % (self.scores['X'], self.scores['0'], self.scores['tie']), True, white)self.player = 'X'self.remaining = 9

def check(self):

 (row, col) = pygame.mouse.get_pos()(row, col) = make_relative(row, col)
 if row < 0 or row > 2 or col < 0 or col > 2:return
 if self.grid[row][col] == None:self.make_move(row, col)

def make_move(self, row, col):centerX, centerY = int(.1 * game_w + row(.2 * game_w)), int(.1 * game_h + col(.2 * game_h))if self.player == 'X':

 pygame.draw.line(self.board, yellow, [centerX-.05game_w, centerY-.05game_h], [centerX+.05game_w, centerY+.05game_h], 3)pygame.draw.line(self.board, yellow, [centerX+.05game_w, centerY-.05game_h], [centerX-.05game_w, centerY+.05game_h], 3)else:pygame.draw.circle(self.board, blue, [centerX, centerY], int(.05*game_w), 3)sound.play()self.grid[row][col] = self.playerself.remaining -= 1

 last_player = self.playerself.player = 'X' if self.player == '0' else '0'self.check_win(last_player)

def has_won(self, whom):self.show()time.sleep(2)self.scores[whom] += 1self.reset()

def check_win(self, player):if self.remaining == 0:return self.has_won('tie')
if wins(self.grid, player):return self.has_won(player)
done = Falseintro = Truegame_board = Board()
buttons = []buttons.append(Button("vs player", .175 * game_w, .8 * game_h, .175 * game_w, .2 * game_h, green_active, green_inactive, lambda: start_game(MODE_VS)))buttons.append(Button("vs computer (hard)", .4 * game_w, .8 * game_h, .175 * game_w, .2 * game_h, red_active, red_inactive, lambda: start_game(MODE_AI)))buttons.append(Button("vs computer (normal)", .625 * game_w, .8 * game_h, .175 * game_w, .2 * game_h, orange_active, orange_inactive, lambda: start_game(MODE_AI_N)))

def start_game(mode):global intro, game_modeintro = Falsegame_mode = mode

 game_board.reset()game_board.show()

\def draw_intro():text = font.render("Select game mode", True, white)screen.blit(text, (.35 * game_w, .4 * game_h))

 for button in buttons:button.draw(screen)
 pygame.display.flip() while not done:for e in pygame.event.get():if e.type == QUIT:done = Trueelif e.type == MOUSEBUTTONUP and intro == False:if game_mode == MODE_VS or game_board.player == 'X':game_board.check()if game_mode != MODE_VS and game_board.player == '0':ai.move(game_board, game_mode)

 if intro:draw_intro()else:game_board.show()

pygame.quit()

For those just getting started in software development, this is the ideal project. You will learn how to work with user-inputted data through this project, which is primarily focused on strings, variables, and concatenation.
The way the programme is designed, users will be prompted to enter a series of input data that will be interpreted as a Mad Lib.

Here’s the Source Code

print("")print("<||<||<|| MAD LIBS GENERATOR ||>||>||>")print("")print("Hey! Let's get started on your Mad Libs.")print("Enter in words as specified below...")

print("")print("")

name = input("Male name: ")adj1 = input("Adjective 1: ")adj2 = input("Adjective 2: ")activity1 = input("Activity 1: ")activity2 = input("Activity 2: ")activity3 = input("Activity 3: ")noun1 = input("Noun 1: ")noun2 = input("Noun 2: ")noun4 = input("Noun 4 (plural): ")place1 = input("Place 1: ")place2 = input("Place 2: ")

print("")print(name, " is a ", adj1, noun1, " who lives in ", place1, " and is from a ", adj2, " family. He lives with his ", noun2, " who is the breadwinner of the family. She earns ", noun4, " by ", activity1, " at Walmart. When ", name, "'s ", noun2, " has free time they ", activity2, " together and have fun ", activity3, "in", place2, ".")print("")print("The end!")

### 7. Rock, Paper, Scissors

We use the random function again in this situation. The programme doesn’t move until you do, then it moves after you do. You have the option of entering an entire string or just one alphabet to indicate the move. It will be necessary to set up a function to verify the move’s legality.

Here’s the Source Code

import random

name = input("Welcome to Rock-Paper-Scissors.\n\nPlease enter your name: ")

game = {'R': 'Rock', 'P': 'Paper', 'S': 'Scissors'}

opt = list(game)

# Input loopwhile True:user = input('\nPick "R" for rock, "P" for paper, "S" for scissors: ')CPU = random.choice(opt)
 if user not in opt:print("You didn't choose a valid option. Please try again\n")elif user == CPU:print("It's a tie. Please play again.\n")else:print('\n{} ({}) : CPU ({})'.format(name, game[user], game[CPU]))win = user + CPU

 if win in ['RS', 'PR', 'SP']:print('{} beats {} \n\nWINNER: {}'.format(game[user], game[CPU], name))elif win in ['SR', 'RP', 'PS']:print('{} beats {} \n\nWINNER: CPU'.format(game[CPU], game[user]))

 break

So yess, we’re done here, hope you enjoyed and learned!
We’ll be coming up with more content like this, till then bye!

#### You may also like

This site uses Akismet to reduce spam. Learn how your comment data is processed.

## SERVICES

✓ Customized M.Tech Projects | ✓ Thesis Writing | ✓ Research Paper Writing | ✓ Plagiarism Checking | ✓ Assignment Preparation | ✓ Electronics Projects | ✓ Computer Science | ✓ AI ML | ✓ NLP Projects | ✓ Arduino Projects | ✓ Matlab Projects | ✓ Python Projects | ✓ Software Projects | ✓ Readymade M.Tech Projects | ✓ Java Projects | ✓ Manufacturing Projects M.Tech | ✓ Aerospace Projects | ✓ AI Gaming Projects | ✓ Antenna Projects | ✓ Mechatronics Projects | ✓ Drone Projects | ✓ Mtech IoT Projects | ✓ MTech Project Source Codes | ✓ Deep Learning Projects | ✓ Structural Engineering Projects | ✓ Cloud Computing Mtech Projects | ✓ Cryptography Projects | ✓ Cyber Security | ✓ Data Engineering | ✓ Data Science | ✓ Embedded Projects | ✓ AWS Projects | ✓ Biomedical Engineering Projects | ✓ Robotics Projects | ✓ Capstone Projects | ✓ Image Processing Projects | ✓ Power System Projects | ✓ Electric Vehicle Projects | ✓ Energy Projects Mtech | ✓ Simulation Projects | ✓ Thermal Engineering Projects

## CONTACT

Fabrum Planet Solutions Pvt. Ltd.