ipl-logo

Csp5110 Unit 1 Programming Principle Paper

340 Words2 Pages

#Name:M.Waleed Liaqat
#Student Number:10385830
#Unit Name :Programming Principle CSP5110
#Instructor name:Greg BAATARD
#Campus:Joondalup

import json

def inputInt(prompt): while True: try: myInt = int(input(prompt))

if myInt < 1: print("input value should be at least 1 or greater") else: break except ValueError: print("Enter Integer greater then 1 or integer value") return myInt

def inputSomething(prompt): while True: userInput = input(prompt) if not userInput.strip(): print( 'Please Enter SomeThing ! ') else: break return userInput

def saveChanges(data): f = open( 'data.txt ', …show more content…

') while True: print( 'Choose [a]dd, [l]ist, [s]earch, [v]iew, [d]elete or [q]uit. ') UserInput = input( '> ') if UserInput == 'a ':

NameOfGame = inputSomething("Enter name of the new game") MinPlayers = inputInt("Enter min number of players") MaxPlayers = inputInt("Enter max number of players") Duration = inputInt("Enter duration of the game") Age = inputInt( 'Min recommended player age: ')

dict = { 'age ':Age, 'duration ':Duration, 'max ':MaxPlayers, 'min ':MinPlayers, 'name ':NameOfGame}

More about Csp5110 Unit 1 Programming Principle Paper

Open Document