示例#1
0
    def new_student(students, branches):
        roll = raw_input("Enter roll no.: ")
        while roll == "":
            print "Incorrect format, Roll no. cannot be blank."
            roll = raw_input("Enter roll no.: ")

        if roll in students:
            print "\n\nERROR! Student already registered!\n\n"
            return

        name = raw_input("Enter name: ")
        while not validations.name(name):
            name = raw_input("Enter name: ")
        c_type = raw_input("Enter course type (UG/PG): ")
        while not validations.c_type(c_type.upper()):
            c_type = raw_input("Enter course type (UG/PG): ")
        sex = raw_input("Enter sex: ")
        while not validations.sex(sex.upper()):
            sex = raw_input("Enter sex: ")
        dob = raw_input("Enter dob (YYYY-MM-DD): ")
        while not validations.date(dob):
            dob = raw_input("Enter dob (YYYY-MM-DD): ")
        doa = raw_input("Enter Date of Admission (YYYY-MM-DD): ")
        while not validations.doa(doa, dob, c_type):
            doa = raw_input("Enter doa (YYYY-MM-DD): ")
        ph = raw_input("Enter phone number: ")
        while not validations.phno(ph):
            ph = raw_input("Enter phone number: ")
        addr = raw_input("Enter Address: ")
        br = raw_input("Enter branch: ")
        b_id = -1
        for key in branches:
            if branches[key]["name"] == br.upper():
                b_id = key
                break
        if b_id == -1:
            print "\n\nERROR! No such branch exists!\n\n"
            return
        students[roll] = {
            "name": name,
            "c_type": c_type,
            "dob": dob,
            "doa": doa,
            "sex": sex.upper(),
            "addr": addr,
            "ph_no": ph,
            "b_id": b_id
        }
        print "\nStudent " + roll + ": " + students[roll][
            "name"] + " registered successfully.\n\n"
示例#2
0
	def new_student(students, branches):
		roll = raw_input("Enter roll no.: ")
		while roll == "":
			print "Incorrect format, Roll no. cannot be blank."
			roll = raw_input("Enter roll no.: ")

		if roll in students:
			print "\n\nERROR! Student already registered!\n\n"
			return

		name = raw_input("Enter name: ")
		while not validations.name(name):
			name = raw_input("Enter name: ")
		c_type = raw_input("Enter course type (UG/PG): ")
		while not validations.c_type(c_type.upper()):
			c_type = raw_input("Enter course type (UG/PG): ")
		sex = raw_input("Enter sex: ")
		while not validations.sex(sex.upper()):
			sex = raw_input("Enter sex: ")
		dob = raw_input("Enter dob (YYYY-MM-DD): ")
		while not validations.date(dob):
			dob = raw_input("Enter dob (YYYY-MM-DD): ")
		doa = raw_input("Enter Date of Admission (YYYY-MM-DD): ")
		while not validations.doa(doa, dob, c_type):
			doa = raw_input("Enter doa (YYYY-MM-DD): ")
		ph = raw_input("Enter phone number: ")
		while not validations.phno(ph):
			ph = raw_input("Enter phone number: ")
		addr = raw_input("Enter Address: ")
		br = raw_input("Enter branch: ")
		b_id = -1
		for key in branches:
			if branches[key]["name"] == br.upper():
				b_id = key
				break
		if b_id == -1:
			print "\n\nERROR! No such branch exists!\n\n"
			return
		students[roll] = {
			"name": name,
			"c_type": c_type,
			"dob": dob,
			"doa": doa,
			"sex": sex.upper(),
			"addr": addr,
			"ph_no": ph,
			"b_id": b_id 
		}
		print "\nStudent " + roll + ": " + students[roll]["name"] + " registered successfully.\n\n"
示例#3
0
    def new_course(courses, branches):
        c_id = raw_input("Enter Course ID: ")
        while c_id == "":
            print "Incorrect format, Course ID cannot be blank."
            c_id = raw_input("Enter Course ID: ")

        if c_id in courses:
            print "\n\nERROR! Course already registered!\n\n"
            return

        c_type = raw_input("Enter course type (UG/PG): ")
        while not validations.c_type(c_type.upper()):
            c_type = raw_input("Enter course type (UG/PG): ")
        name = raw_input("Enter course name: ")
        while not validations.name(name):
            name = raw_input("Enter course name: ")
        cred = raw_input("Enter credits: ")
        while not validations.cred(cred):
            cred = raw_input("Enter credits: ")
        sem = raw_input("Enter sem: ")
        while not validations.sem(sem, c_type.upper()):
            sem = raw_input("Enter sem: ")
        br = raw_input("Enter branch: ")
        b_id = -1
        for key in branches:
            if branches[key]["name"] == br:
                b_id = key
                break
        if b_id == -1:
            print "\n\nERROR! No such branch exists!\n\n"
            return

        courses[c_id] = {
            "c_type": c_type.upper(),
            "name": name,
            "b_id": b_id,
            "cred": cred,
            "sem": sem
        }
        print "\nCourse " + c_id + ": " + courses[c_id][
            "name"] + " registered successfully.\n\n"
示例#4
0
	def new_course(courses, branches):
		c_id = raw_input("Enter Course ID: ")
		while c_id == "":
			print "Incorrect format, Course ID cannot be blank."
			c_id = raw_input("Enter Course ID: ")

		if c_id in courses:
			print "\n\nERROR! Course already registered!\n\n"
			return

		c_type = raw_input("Enter course type (UG/PG): ")
		while not validations.c_type(c_type.upper()):
			c_type = raw_input("Enter course type (UG/PG): ")
		name = raw_input("Enter course name: ")
		while not validations.name(name):
			name = raw_input("Enter course name: ")
		cred = raw_input("Enter credits: ")
		while not validations.cred(cred):
			cred = raw_input("Enter credits: ")
		sem = raw_input("Enter sem: ")
		while not validations.sem(sem, c_type.upper()):
			sem = raw_input("Enter sem: ")
		br = raw_input("Enter branch: ")
		b_id = -1
		for key in branches:
			if branches[key]["name"] == br:
				b_id = key
				break
		if b_id == -1:
			print "\n\nERROR! No such branch exists!\n\n"
			return

		courses[c_id] = {
		"c_type": c_type.upper(),
		"name": name,
		"b_id": b_id,
		"cred": cred,
		"sem": sem
		}
		print "\nCourse " + c_id + ": " + courses[c_id]["name"] + " registered successfully.\n\n"