so here is my code
from math import sqrt
class ageName:
"class to represent a person"
def _init_(self):
self.name = ""
self.age = 0.0
self.sqrtage = 0
g = ageName()
g.name = raw_input("Enter a name, or stop to exit: ")
g.age = int(raw_input("Enter an age: "))
g.sqrtage = sqrt(g.age)
list1 = dict()
list1[g.name] = g.age
print g.name, g.age, g.sqrtage
print list1
while g.name != 'stop':
g.name = raw_input("Enter a name, or stop to exit: ")
if g.name == 'stop':
break
else:
g.age = int(raw_input("Enter an age: "))
g.sqrtage = sqrt(g.age)
list1.append(g.name)
list1[g.name] = g.age
print g.name, g.age, g.sqrtage
print list1
the last few lines are wrong
I want to add new key-value pair to a dict
list1 = {'joe': 11, 'john', 19} for example
How do I do that? I have read the docs and google and still can't figure out a way