CIS275LabProject1 - CIS 275 (Discrete Mathematics) LAB...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 275 (Discrete Mathematics) LAB PROJECT 1 Source Code in Python >>> import cmd class interface(cmd.Cmd): def prompt(mySet): print "Please enter the type number for function you would like to choose"\ " %c to %c:\n 1 for one to one\n 2 for onto\n 3 for one to one"\ " and onto\n 4 for not one to one: "%(mySet.setNum, mySet.setNext) def setType(mySet, type=0): while(int(type) >4 or int(type) < 1): type = int(input("Enter one number for type: ")) print "\a" return type def makeSet(mySet, size=0): while(20 < int(size) or 2 > int(size)): size = int(input("How many elements for set %c?"\ "(20 or less): "%mySet.setNum)) print "" return size def do_start(mySet): #setup mySet.presize = 0 mySet.type = 0 mySet.size = 0 mySet.setNum = "A" mySet.setNext = "B" mySet.wrongSize = "\a\nThis is wrong size. Must be %s than '%s'.\n" #build set A mySet.prompt() mySet.type_one = mySet.setType() mySet.size_one = mySet.makeSet() mySet.setNum = mySet.setNext mySet.setNext = "C" #build set B mySet.prompt() mySet.type_two = mySet.setType() if(mySet.type_one == 3):
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
mySet.presize = mySet.size_one
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/06/2008 for the course CIS 275 taught by Professor Campfner during the Fall '07 term at University of Michigan.

Page1 / 5

CIS275LabProject1 - CIS 275 (Discrete Mathematics) LAB...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online