[source code] Python Programming Tutorial - 13 - Return Value

+5 Bucky Roberts · August 27, 2014

def allowed_dating_age(my_age):
    girls_age = my_age/2 + 7
    return girls_age

buckys_limit = allowed_dating_age(27)
creepy_joe_limit = allowed_dating_age(49)
print("Bucky can date girls", buckys_limit, "or older")
print("Creepy Joe can date girls", creepy_joe_limit, "or older")

'''
*** Challenge 2 ***
Display a list of the dating limits for guys 15-65 years old
Good luck!
'''

Post a Reply

Replies

Oldest  Newest  Rating
+1 Joseph Schlitz · April 23, 2017
def allowed_dating_age(my_age):
   girls_age = my_age/2 + 7
   return(girls_age)

for x in range(15,66,1):
   list_limit = allowed_dating_age(x)
   print("A person whose age is",x," can only date those who are",list_limit,"years or older")
0 Kamran Qaderi · December 20, 2014

def limit(age):
  girl = age/2+7
  return(girl)

print('Age', 'limit')
for age in range(15,66):
  print(age, limit(age))

+1 Gary Murphy · September 10, 2014
def allowed_dating_age(age):
    girls_age = age/2 + 7
    return girls_age

for guys in range(16, 66):
    print"Guys aged", guys, "can date girls", allowed_dating_age(guys), "or older."
+1 Liam Hughes · August 31, 2014
def allowed_dating_age(my_age):
    girls_age = my_age/2 + 7
    return girls_age

print("AGE  :  LIMIT")
for i in range(15, 66):
    print(i, ":", allowed_dating_age(i))
+3 Logan O'Neill · August 29, 2014
I'm loving the challenges bucky!
def allowed_dating_range(age):
    girls_age = age/2 + 7
    return girls_age

for x in range(15, 66):
    x = allowed_dating_range(x)
    print (x)
  • 1

Python

124,767 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator