Python Programming Tutorial - 13 - Return Values (Challenge)

+3 Mr. Computer · January 13, 2015
def allowed_dating_age(guys_age):
       girls_age = guys_age / 2 + 7
       return girls_age


for ages in range(15, 61):
    guys_limit = allowed_dating_age(ages)
    print('Guys in age of ', ages, 'can date girls in age of', guys_limit, 'and older')
    
    #MozamelSaber

Result :
Guys in age of  15 can date girls in age of 14.5 and older
Guys in age of  16 can date girls in age of 15.0 and older
Guys in age of  17 can date girls in age of 15.5 and older
Guys in age of  18 can date girls in age of 16.0 and older
Guys in age of  19 can date girls in age of 16.5 and older
Guys in age of  20 can date girls in age of 17.0 and older
Guys in age of  21 can date girls in age of 17.5 and older
Guys in age of  22 can date girls in age of 18.0 and older
Guys in age of  23 can date girls in age of 18.5 and older
Guys in age of  24 can date girls in age of 19.0 and older
Guys in age of  25 can date girls in age of 19.5 and older
Guys in age of  26 can date girls in age of 20.0 and older
Guys in age of  27 can date girls in age of 20.5 and older
Guys in age of  28 can date girls in age of 21.0 and older
Guys in age of  29 can date girls in age of 21.5 and older
Guys in age of  30 can date girls in age of 22.0 and older
Guys in age of  31 can date girls in age of 22.5 and older
Guys in age of  32 can date girls in age of 23.0 and older
Guys in age of  33 can date girls in age of 23.5 and older
Guys in age of  34 can date girls in age of 24.0 and older
Guys in age of  35 can date girls in age of 24.5 and older
Guys in age of  36 can date girls in age of 25.0 and older
Guys in age of  37 can date girls in age of 25.5 and older
Guys in age of  38 can date girls in age of 26.0 and older
Guys in age of  39 can date girls in age of 26.5 and older
Guys in age of  40 can date girls in age of 27.0 and older
Guys in age of  41 can date girls in age of 27.5 and older
Guys in age of  42 can date girls in age of 28.0 and older
Guys in age of  43 can date girls in age of 28.5 and older
Guys in age of  44 can date girls in age of 29.0 and older
Guys in age of  45 can date girls in age of 29.5 and older
Guys in age of  46 can date girls in age of 30.0 and older
Guys in age of  47 can date girls in age of 30.5 and older
Guys in age of  48 can date girls in age of 31.0 and older
Guys in age of  49 can date girls in age of 31.5 and older
Guys in age of  50 can date girls in age of 32.0 and older
Guys in age of  51 can date girls in age of 32.5 and older
Guys in age of  52 can date girls in age of 33.0 and older
Guys in age of  53 can date girls in age of 33.5 and older
Guys in age of  54 can date girls in age of 34.0 and older
Guys in age of  55 can date girls in age of 34.5 and older
Guys in age of  56 can date girls in age of 35.0 and older
Guys in age of  57 can date girls in age of 35.5 and older
Guys in age of  58 can date girls in age of 36.0 and older
Guys in age of  59 can date girls in age of 36.5 and older
Guys in age of  60 can date girls in age of 37.0 and older

Post a Reply

Replies

Oldest  Newest  Rating
0 Stanciu Bogdan Mircea · May 13, 2015
the world should appreciate this numbers
+1 Diogo Pacheco Pedro · February 6, 2015
#Function
def allowed_dating_age(guys_age):
girls_age = guys_age/2 + 7
return girls_age

for ages in range(20,60):
Guys_limit = allowed_dating_age(ages)

print("The guys age is", Guys_limit, "the girls is", ages, "or older")

:)
  • 1

Python

107,085 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator