Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #---------- WRITING TO A FILE --------#
- def write():
- gamename = input('Enter game name: ')
- agerating = input('Enter age rating: ')
- gameFile = open('gamedetails.txt' , 'a')
- gameFile.write(gamename + ',')
- gameFile.write(agerating + ',')
- gameFile.close()
- def read():
- gameFile = open('gamedetails.txt' , 'r')
- gameReport = gameFile.read().split(',')
- print(gameReport)
- gameSearch = input('Enter search: ')
- if gameSearch in gameReport:
- print('Wooo')
- else:
- print('u wot?')
- gameFile.close()
- read()
- ################################################################################
- #-------- IF STATEMENTS ----------#
- def question1():
- attempts = 3
- while attempts != 0:
- question = input('''What colour is the sky?
- 1. Blue
- 2. Green
- 3. yellow
- >>> ''')
- if question == '1':
- print('Correct')
- attempts = 0
- elif question == '2':
- print(' U mad? ')
- attempts = attempts - 1
- print('You have ' , attempts , 'left')
- else:
- print('Incorrect')
- attempts = attempts - 1
- print('You have ' , attempts , 'left')
- question1()
- print('Next question')
- #############################################################################
- #-------------EMAIL CREATION -----------------#
- firstname = input('Enter name: ')
- surname = input('Enter surname: ')
- l1 = firstname[0:3]
- print(l1 + surname +'@bedfordacademy.co.uk')
Add Comment
Please, Sign In to add comment