fork download
  1. class human(object):
  2. kind = 'humam'
  3. def __init__(self,name, sex, age):
  4. self.name = name
  5. self.sex = sex
  6. self.age = age
  7. def report(self):
  8. print(self.name)
  9. print(self.sex)
  10. print(self.age)
  11. com = int(input('What would you like to do: \n 1) Add a contact \n 2) Info on a contact \n 3) Break\n'))
  12.  
  13. humans = []
  14.  
  15. while com != 3:
  16. if com == 1:
  17. name,sex,age = input('Enter name sex age: ').split()
  18. humans.append(human(name,sex,age))
  19. if com == 2:
  20. name = input('Enter name: ')
  21. for somehuman in humans:
  22. if name in somehuman.name:
  23. somehuman.report()
  24. com = int(input('What would you like to do: \n 1) Add a contact \n 2) Info on a contact \n 3) Break\n'))
  25.  
Success #stdin #stdout 0.02s 27720KB
stdin
1
marco m 22
1
joana f 27
2
marco
3
stdout
What would you like to do: 
 1) Add a contact 
 2) Info on a contact 
 3) Break
Enter name sex age: What would you like to do: 
 1) Add a contact 
 2) Info on a contact 
 3) Break
Enter name sex age: What would you like to do: 
 1) Add a contact 
 2) Info on a contact 
 3) Break
Enter name: marco
m
22
What would you like to do: 
 1) Add a contact 
 2) Info on a contact 
 3) Break