Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. colon missing, line 5
- 2. range length should be 5
- 3. age variable syntax should be: ages[person]
- 4. year_of_birth variable calculation should be the other way round: current_year - age
- 5. 'name' in output shoube just: name
- 6. year_of_birth in output needs to be converted to string
- The code:
- -----------------------
- import datetime
- names = ['Alice', 'Bob', 'Carol', 'Dan', 'Eve']
- ages = [22, 32, 18, 57, 41]
- c_year= datetime.datetime.now().year
- for person in range(5):
- age = ages[person]
- name = names[person]
- year_of_birth = c_year - age
- print(name + ' was born in ' + str(year_of_birth))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement