0% found this document useful (0 votes)
36 views

My Python Projects

The document describes 3 Python projects: 1) A quiz game that asks the user computer-related questions and displays their score. 2) A mad libs game that generates a story by filling in user-provided parts of speech. 3) An internet speed test program that uses the speedtest module to measure download and upload speeds and display them.

Uploaded by

Anmol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

My Python Projects

The document describes 3 Python projects: 1) A quiz game that asks the user computer-related questions and displays their score. 2) A mad libs game that generates a story by filling in user-provided parts of speech. 3) An internet speed test program that uses the speedtest module to measure download and upload speeds and display them.

Uploaded by

Anmol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

My Python Projects:

1) Quiz Game
Code:
print ('*****************************************')
print (' "Welcome to my Computer Quiz game" ')
print ('*****************************************')
playing = input ('Do you want to play? ')

if playing.lower () != 'yes':
print ('Okey Will Play another time!')
quit ()
else:
print ("Okey! Lets Play")
score = 0
ans = input ('Q:1) What does CPU Stands for? ')
if ans.lower () == 'central processing unit':
print ('Correct! ')
score += 1
else:
print ('Incorrect!')

ans = input ('Q:2) What does GPU Stands for? ')


if ans.lower () == 'graphic processing unit':
print ('Correct! ')
score += 1
else:
print ('Incorrect!')
ans = input ('Q:3) What does RAM Stands for? ')
if ans.lower () == 'random access memory':
print ('Correct! ')
score += 1
else:
print ('Incorrect!')

ans = input ('Q:4) What does PSU Stands for? ')


if ans.lower () == 'power supply':
print ('Correct! ')
score += 1
else:
print ('Incorrect!')

ans = input ('Q:5) What does GUI Stands for? ')


if ans.lower () == 'graphic user interface':
print ('Correct! ')
score += 1
else:

print ('Incorrect!')

ans = input ('Q:6) What is the capital of france? ')


if ans.lower () == 'paris':
print ('Correct! ')
score += 1
else:
print ('Incorrect!')

ans = input ('Q:7) What is the largest country in the world? ')
if ans.lower () == 'russia':
print ('Correct! ')
score += 1
else:
print ('Incorrect!')

ans = input ('Q:8) What is the capital of Iran? ')


if ans.lower () == 'tehran':
print ('Correct! ')
score += 1
else:
print ('Incorrect!')

print ('*****************************************')
print ('You answered ' + str (score) + ' questions correct out of 8
')
print ('You scored: ' + str ((score / 8) * 100) + '% ')
print ('*****************************************')
Output:
2) Mad Libs Generator Game:
Code:
print('***********************************************************')
print(' "Mad Libs Generator Game!" ')
print('***********************************************************')
ans = input('Do you want to play? ')
if ans.lower()!='yes':
print("It's Okey, we'll play next time")
quit()
else:
animals = input ('enter a animal name : ')
profession = input ('enter a profession name: ')
cloth = input ('enter a name of outfit: ')
things = input ('enter a thing name: ')
name = input ('enter a name: ')
place = input ('enter a place name: ')
verb = input ('enter a verb in ing form: ')
food = input ('food name: ')

print('***********************************************************')
print (' "MAD Story" ')
print('***********************************************************')
print (
'say ' + food + ', the photographer said as the camera flashed! \n' +
name + ' and I had gone to ' + place + ' to get our photos taken on my
birthday. \nThe first photo we really wanted was a picture of us dressed \nas
' + animals + ' pretending to be a ' + profession + '. \nwhen we saw the
second photo, it was exactly what I wanted. \nWe both looked like ' + things +
' wearing ' + cloth + '\nand ' + verb + ' --exactly what I had in mind')
print ('***********************************************************')
ans1 = input('Do you wanna play again? ')
if ans1.lower()!='yes':
print('Okey see you soon')
quit()
else:

adjactive = input ('enter adjective : ')


color = input ('enter a color name : ')
thing = input ('enter a thing name :')
place = input ('enter a place name : ')
person = input ('enter a person name : ')
adjactive1 = input ('enter a adjactive : ')
insect = input ('enter a insect name : ')
food = input ('enter a food name : ')
verb = input ('enter a verb name : ')
print
('***********************************************************')
print (' "MAD Story"
')
print
('***********************************************************')
print ('Last night I dreamed I was a ' + adjactive + ' butterfly \
nwith ' + color + ' splocthes that looked like ' + thing + ' .\nI flew to ' +
place + ' with my bestfriend and \n' + person + ' who was a ' + adjactive1 + '
' + insect + ' .\nWe ate some ' + food + ' when we got there and \nthen
decided to ' + verb + ' and the dream ended \nwhen I said-- lets ' + verb +
'.')
print
('***********************************************************')
ans1 = input ('Do you wanna play again? ')
if ans1.lower () != 'yes':
print ('Okey see you soon')
quit()
else:

person = input ('enter person name: ')


color = input ('enter color : ')
foods = input ('enter food name : ')
adjective = input ('enter aa adjective name: ')
thing = input ('enter a thing name : ')
place = input ('enter place : ')
verb = input ('enter verb : ')
adverb = input ('enter adverb : ')
food = input ('enter food name : ')
things = input ('enter a thing name : ')
print
('***********************************************************')
print (' "MAD Story"
')
print
('***********************************************************')
print (
'Today we picked apple from ' + person + "'s Orchard. \nI had no idea
there were so many different varieties \nof apples. I ate " + color + ' apples
straight off the \ntree that tested like ' + foods + '. Then there \nwas a ' +
adjective + ' apple that looked like a ' + thing + '.\nWhen our bag were full,
we went on a free hay ride\n to ' + place + ' and back. It ended at a hay pile
\nwhere we got to ' + verb + ' ' + adverb + '. I can hardly wait \nto get home
and cook with the apples. \nWe are going to make appple ' + food + ' and ' +
things + ' pies!.')
print
('***********************************************************')
Output:
3) Internet Speed Test:
Code:
from tkinter import *
import speedtest

def speedcheck():
sp = speedtest.Speedtest()
sp.get_servers()
down = str(round(sp.download()/(10**6),3))+'Mbps'
up = str(round(sp.upload()/(10**6),3))+'Mbps'
lab_down.config(text=down)
lab_up.config(text=up)

sp = Tk()
sp.title('Internet Speed Test')
#geometry make a size
sp.geometry('500x650')
#config create the bg color, font size etc
sp.config(bg='Light Blue')
#lab is a variable for labeling somethin
lab = Label(sp,text='Internet Speed Test',
font=('Algerian',25,'bold'),bg='Light Blue', fg='Purple')
#to see the spacing
lab.place(x=60,y=40,height=50,width=380)

lab = Label(sp,text='Download Speed', font=('Time New Roman',28,'bold'))


lab.place(x=60,y=130,height=50,width=380 )

lab_down = Label(sp,text='00', font=('Time New Roman',28,'bold'))


lab_down.place(x=60,y=200,height=50,width=380)

lab = Label(sp,text='Upload Speed', font=('Time New Roman',28,'bold'))


lab.place(x=60,y=290,height=50,width=380)

lab_up = Label(sp,text='00', font=('Time New Roman',28,'bold'))


lab_up.place(x=60,y=360,height=50,width=380)

button = Button(sp,text='Check Speed',font=('Time New


Roman',28,'bold'),relief=RAISED,bg='Red',command=speedcheck)
button.place(x=60,y=460,height=50,width=380)

sp.mainloop()
Output:

You might also like