Difference between revisions of "CSC111 studentClass Programs"
Line 57: | Line 57: | ||
<br /> | <br /> | ||
+ | <onlydft> | ||
==Version 2== | ==Version 2== | ||
Line 545: | Line 546: | ||
</source> | </source> | ||
<br /> | <br /> | ||
− | + | </onlydft> | |
<br /> | <br /> | ||
<br /> | <br /> |
Latest revision as of 04:23, 8 April 2010
--D. Thiebaut 11:51, 7 April 2010 (UTC)
A collection of programs illustrating the use of classes and objects...
Contents
Version 1
"""
studentClass.py
D. Thiebaut
A program for the Exercises on Class/Objects
Creates a class to keep information about a student.
The class keeps track of the student's name, account number,
password, and email address.
Object issued from this class have methods to
- print the student information (everything we know about a student)
- create a new student with all the information
- get the name of a student
- get the account number
- get the password
- get the email
- change the email address
"""
text="""
111c-ca, Liz Cloud, xxyzzyK, lcloud@email.smith.edu
111c-cb, Fiona Poory, ahlhla, fpoory@email.smith.edu
111c-ck, Alex Doe, aluoiid, adoe@gmail.com
"""
def parseInput( text ):
lines = text.split( "\n" )
List = []
for line in lines:
words = line.split( ',' )
if len( words )==4:
(account, name, passw, email) = words
List.append( (account, name, passw, email) )
def main():
List = parseInput( text )
main()