""" Read from file; store in nested dict Read line by line: - Create one dict for each line - Add to main dict Challenge: split will not work """ humans = {} with open('human_evolution.txt') as infile: for line in infile: if line[0] == 'H': name = line[:20].strip() when = line[21:35].strip() height = line[37:47].strip() mass = line[50:59].strip() brain = line[61:].strip() humans[name] = {'when':when,'height':height,'mass':mass,'brain':brain} for name in humans: h = humans[name] print(f"{name:20} {h['when']:15} {h['height']:10} {h['mass']:10} {h['brain']:10}") """ Terminal> python humans.py H. habilis 2.2 - 1.6 1.0 - 1.5 33 - 55 660 H. erectus 1.4 - 0.2 1.8 60 850 (early) - 1100 (late) H. ergaster 1.9 - 1.4 1.9 700 - 850 H. heidelbergensis 0.6 - 0.35 1.8 60 1100 - 1400 H. neanderthalensis 0.35 - 0.03 1.6 55 - 70 1200 - 1700 H. sapiens sapiens 0.2 - present 1.4 - 1.9 50 - 100 1000 - 1850 H. floresiensis 0.10 - 0.012 1.0 25 400 """