Hello! This is my third week in Python and my knowledge is still close to 0! Not to mention, I get confused with C so, so much!
I need some help with the following task:
Write a function
readEntry that takes a string of the form
NAME:AGE and returns a dictionary of
the form
"name":NAME, "age": AGE where NAME is a string and AGE is an integer.
So far I got this:
Code:
def readEntry(s):
info = {}
info["name"] = name
info ["age"] = age
return info
s.split([':'])
if s <= ':':
return str(name)
else s => ':':
return int(age);
I was actually going to go for a 'for ' loop but thanks to my confusing instructor I'm stuck with using an unfamiliar function 's.split' so...
I'm stuck!
And wait! It has a continuation!
Write a function
readEntryList that takes a string (a file name), reads that file, and interprets
every line in the file as a age entries (by calling
readEntry). The function should return a list of
entries in the same order as in the file.