Advertisement
GCK

GCK/ average min age from list of real data

GCK
Sep 26th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. """
  2. Real World data
  3. Estimated average age of young people leaving the parental household by sex
  4. """
  5. print("Hello I'm gigi your bot. Lets deal with maximums on real world problem lists")
  6.  
  7. countries=["Belgium","Bulgaria","Czechia", "Denmark", "Germany","Estonia", "Ireland","Greece", "spain", "France","Croatia"]
  8. males=[24.1,31.1,27.7,21.3,24.4,23.4,27.1,30.7,30.3,25.0, 33.4]
  9. females=[22.8,26.5,25.1,20.8,22.9,22.9,25.6,28.0,28.3,23.1,30.4]
  10.  
  11.  
  12. """ this function will find the averaged min age for moving out from home and return the country
  13. """
  14.  
  15. def countries_millenials_movingout_min_age(list_of_age):
  16.     min=list_of_age[0]
  17.    
  18.     for i in range(len(list_of_age)):
  19.         if list_of_age[i]<min:
  20.             min=list_of_age[i]
  21.         index=list_of_age.index(min)
  22.     return min,countries[index]
  23.  
  24.  
  25. female_age,fromWhere=countries_millenials_movingout_min_age(females)
  26. print("The youngest female moved at age of {} from {}".format(female_age,fromWhere))
  27. male_age,fromWhere2=countries_millenials_movingout_min_age(males)
  28. print("The youngest male moved at age of {} from {}".format(male_age,fromWhere2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement