+ 1

Given a list of birth years calculate how old these people will be in the year 2050 and, output the resulting list.

I m not a pro member so i am unable to open it. but i want to understand these type of code coach problems.can anyone help me to understand this?

13th Jan 2021, 5:02 AM
Rahul Prasad
Rahul Prasad - avatar
8 odpowiedzi
+ 8
It's not possible, you have to take Pro for unlocking all lessons and code-coaches, but if you wanna know these questions you can talk with a pro member. But I think it's not fair.
13th Jan 2021, 5:19 AM
Abhiyantā
Abhiyantā - avatar
+ 1
If you wish to understand it, then write your own concept and test the results against values you can manually calculate. This will give you a much deeper understanding, & teach you how to develop code without relying on others to validate
13th Jan 2021, 7:52 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
birth_years = [1995, 2004, 2019, 1988, 1977, 1902] #1. All birth years stored in this list result=list(map(lambda x: 2050-x,birth_years))#2. Ages calculated and stored in this list using map and lambda print(result) #3. Print the age list
3rd Jun 2021, 6:23 PM
Shubhang
+ 1
def future_age(x): return 2050 - x birth_years = [1995, 2004, 2019, 1988, 1977, 1902] result = list(map(lambda x: 2050 -x, birth_years)) print(result)
16th Aug 2021, 8:11 PM
Hugues Rodrigue Tha Andela
Hugues Rodrigue Tha Andela - avatar
+ 1
birth_years = [1995, 2004, 2019, 1988, 1977, 1902] #your code goes here b=list(map(lambda x: -x+2050,birth_years)) print(b)
26th Aug 2021, 7:32 PM
Syed Babar Shah
Syed Babar Shah - avatar
+ 1
birth_years = [1995, 2004, 2019, 1988, 1977, 1902] #your code goes here result = list(map(lambda x: 2050-x, birth_years)) print(result)
17th Dec 2021, 8:34 AM
Matt Webb
0
Ill help you understand it. Stop being cheap and buy the pro membership
5th Mar 2022, 11:46 PM
Jake Ambrose
Jake Ambrose - avatar
- 1
Think this is shortest code: result = list(map(lambda x: (x-2050)*-1, birth_years)) print(result) Ask if u have questions!
17th Nov 2021, 5:48 PM
Stefan Bartl
Stefan Bartl - avatar