Python - 13 - Return Values - Homework solution

0 Sorin-Mihai Oprea · October 4, 2015
def allowed(my_age):
    girl_age = my_age//2 + 7
    return girl_age

for n in range(14, 60):
    limit = allowed(n)
    n += 1
    print(" I can date girls no younger than", limit, "if I'm", n, "years old.")

Post a Reply

Replies

Oldest  Newest  Rating
0 Halcyon Abraham Ramirez · October 10, 2015
your'e welcome
0 Sorin-Mihai Oprea · October 10, 2015
Thanks Halcyon.
0 Halcyon Abraham Ramirez · October 5, 2015
just a quick suggestion
since you are literally not using the variable girl_age in your allowed function you can do this



def allowed(my_age):
return my_age//2 + 7

also you can do this for your for loop


for n in range(14, 60):
print(" I can date girls no younger than {0} if I'm {1} years old."\
.format(allowed(n),n))
n+= 1
  • 1

Python

124,688 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator