## Python Programming Tutorial – 13 – Return Values

GitHub – https://github.com/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/

• Views:251,776 views
• Rating:
• Categories:
• Tags:

defialpro says:

for x in range (15,65):
girlsage = x / 2 + 7
print (“you are {} years old and you can date a {} year old”.format(x,girlsage))

progress is beautiful says:

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

for person in range(25,61):
range = allowed_age(person)
print(person, “age, has a date limit of”, range)

Hemu Kalyandurga says:

Bucky at his best!! If all tutorials would have been like this many more people would have learned programming…

Sravanthi T says:

def ppl_age(my_age):
girl_age = my_age/2 + 7
return girl_age

for n in range(15,60):
ages = ppl_age(n)
print(ages)

Donanxhelo Malo says:

def allowed_dating_age(age):
opposite_sex_age = age/2 + 7
return opposite_sex_age

johns_age = 15
johns_limit = allowed_dating_age(15)
print(“Johns age is”, johns_age, “and his allowed dating age is”, johns_limit,”or older”)

Gabriel Fonsêca says:

def allowed_age(age):
girls_age = age / 2 + 7
print (“You’re allowed to date girls from”, girls_age, “years old”)

for a in range(15,61):
allowed_age(a)

Francis A says:

def allowed_dating_age(age):
girls_age=age/2+7
return girls_age
for x in range(15,61):
limit = allowed_dating_age(x)
print(‘The person of age’,x,’can date girls of age’,limit,’or more’)

Thanks bucky (Y)

William Jimenez says:

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

for n in range (16,61):
andres_limit = allowed_dating_age(n)
print(“Andre is”,n,”, he can date girls”,andres_limit, “or older”)

mehmood khan says:

idiot

Thuy Pham says:

Thank you so much, I’m really into your tutorials.
def date_age_lim(my_age):
age_limit = (my_age // 2) + 8
return age_limit

for x in range(15, 50):
limited_age = date_age_lim(x)
print(‘you are’, x, ‘your partner’s limited age is’,limited_age)

PRashant Pant says:

For girls dating age limit can be calculated by
Men_age= Girl_age*2 -7

NecessariusVerum says:

def my_age_limit(my_age):
girls_age=my_age/2+7
return girls_age
for my_age in range (15,61):
my_limit=my_age_limit(my_age)
print(“My age is”,my_age,”and my limit is”, my_limit)

eric valencia says:

I’m super happy!!!
New to coding I completed the “Homework” and after attempting to run it for the first time I didn’t get a single error!!
Please review my code. I know I should have turned the multiple print statements into a for loop but I was too happy when I solved this problem in mear mins.

I also typecast the result… well because 24.5 makes no sense. who dates a girl 24.5 years old?? WHO?!?

list_of_ages = [35,40,45,50,55,60]
def age_limit (list_of_ages):
girls_age = list_of_ages / 2 + 7
return girls_age

guy0 = age_limit(list_of_ages [0])
guy1 = age_limit(list_of_ages [1])
guy2 = age_limit(list_of_ages [2])
guy3 = age_limit(list_of_ages [3])
guy4 = age_limit(list_of_ages [4])
guy5 = age_limit(list_of_ages [5])

print(“Guy number one age: “,list_of_ages[0], ” can date a girl as young as:”, int(guy0), “or older”)
print(“Guy number Two age: “,list_of_ages[1], ” can date a girl as young as:”, int(guy1), “or older”)
print(“Guy number three age: “,list_of_ages[2], ” can date a girl as young as:”, int(guy2), “or older”)
print(“Guy number four age: “,list_of_ages[3], ” can date a girl as young as:”, int(guy3), “or older”)
print(“Guy number five age: “,list_of_ages[4], ” can date a girl as young as:”, int(guy4), “or older”)
print(“Guy number six age: “, list_of_ages[5], ” can date a girl as young as:”,int(guy5), “or older”)

OUTPUT::
Guy number one age: 35 can date a girl as young as: 24 or older
Guy number Two age: 40 can date a girl as young as: 27 or older
Guy number three age: 45 can date a girl as young as: 29 or older
Guy number four age: 50 can date a girl as young as: 32 or older
Guy number five age: 55 can date a girl as young as: 34 or older
Guy number six age: 60 can date a girl as young as: 37 or older

wat if ur 14 and ur gf is 14 but 1 month younger

Jackson Lee says:

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

for x in range(15,61):
agelimit = allowed_dating_age(x)
print(‘If you are ‘,x,’ you are allowed to date a’,agelimit,’year old female’)

AstonishingStudios says:

def allowed_age(my_age):
her_age=my_age/2+8 #Add eight years because 7 is pushing it
return her_age

for x in range (15, 61):
man_limit = allowed_age(x)
print(x, “year old men can date”, man_limit, “old women.”)

Samir Tendulkar says:

Best Code:
for GuysAge in range(15,61):
def Eligible_Girl(GuysAge):
GirlsAge = GuysAge/2 + 7
return GirlsAge
print(“Guy of age “, GuysAge, ” Can date a girl who’s age is”, Eligible_Girl(GuysAge))

Faisal AlKusayer says:

I’m 14… and I got 14…

said maroc says:

def whichage(age):
girlage = age/2 +7
return girlage

for i in range(15,66):
girlage2 = whichage(i)
print(“the minimum girl age for a man whose age is “,i,” is :”,girlage2)

Tom Nimanju says:

Give this man some beef, he deserves it.

Besnik Nuro says:

list = []

def func1(m, n): #the idea is you can set the range yourself by choosing what values m(minimum) and n(maximum) are
for o in range(m, n):
list.append(o) #func1 creates a list with all the ages in the set range
def func2(): #this is a just a table that is neatly formatted(on my PyCharm at least)
print(“Age:”, “tMinimum:”)
for n in list:
limit = n/2 + 7
age = n
print(age, “t”* 2, limit)
func1(14, 45) #just calling the functions and set m and n in the first function
func2()
print(list) #did this to see if things were working as intended

Sorry for complexity

Ankita Roy says:

Homework:

def yo_matrimony (age):
marriageAge= age/2+7
return marriageAge

for x in range (15,60):
print ( x, ” ” ,yo_matrimony(x) )

Nicat Behbudov says:

My code:

def age_allowed_todate (your_age):
girls_age = your_age / 2 +7
return girls_age

for i in range(15,61):
my_limit = age_allowed_todate(i)
print(i, my_limit)

bella boom says:

does this gives the intended result?
I think the logic is a bit off.
What would you recommend me do in order for it to yield the correct result?

def date(age,page):
for i in range(15,61):
bage = (age)/2 +7
if (bage >= page):
print(“Anna can date boys up to”,bage,”or older”)
print(“The are compatible”,page,”and”,bage)
print(page,bage)
else:
print(“No way hosay,”,page,”and”,bage)
print(page,bage)
break

Ramesh Ram says:

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

for i in range(15,61):
x=allowed_dating_age(i)
print(i,x)

Saif Ahmed says:

My code:

def speedlimiter(speed):
if speed <=25: return "You are good" else: return "You are fucked" BMW = speedlimiter(45) print("Hello", BMW) Mercedes = speedlimiter(15) print("Hello", Mercedes)

THE GRTEAT PIRATE FREE STUFF says:

I’m 12 my limit is 13 !
that just wrong man
she is too young for me !

This will give the age details for people between 16 – 70

def func1(myage):
allowed_girls_age = (int(myage)/2 + 7)
print(“People on age ” + str(myage) + ” : ” + “can date with older than : ” + str(allowed_girls_age))
return (allowed_girls_age)

# Just allowed the person’s age criteria as more than 15 years
for age in range(15,70):
if int(age) > 15:
func1(age)

Mehmed Çavaş says:

that not used paranteses and semicolons for better and easier looking but i think with them were the languages better like C or Java. I know both of them and think that with paranteses and semicoloms the language looks more organized

Imagination Over Knowledge says:

def dating_age_limit():
for f in range(15, 61):
print(“Dude’s age:”, f, “can date girls”, f/2 + 7, “or older”)
dating_age_limit()

Alex Hung says:

Hi Bucky, I ran the following code but the result is not what I expected (the result is 0, which it shouldn’t be). Could you kindly help?

portion=(current_price-16)/(30-16)
return portion

print(total_allocation)

Dan Ha says:

the limit of a 12 year old boy would be 13 lol

Riya Poddar says:

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

for age in range (15, 60):
limitofpeople= allowed_dating_age (age)
print(age, limitofpeople)

Nikolas Fu says:

def allowed_dating_age(persons_age):
girls_age = persons_age/2 + 10
return girls_age

for i in range(15, 60):
age_limit = allowed_dating_age(i)
print(i, age_limit)

Tunde Olowu says:

name = [“Bayo”, “Usman”, “Charles”, “Kelechi”, “Ibibabo”]
age = [27, 36, 19, 23, 41]

def allowed_dating_age(boy_age):
girl_age = boy_age/2 + 7
return(girl_age)

for n in range(5):
print(name[n], ” is”, age[n], “years old and can date girls of “, allowed_dating_age(age[n]), “years of age and above”)

Output:
Bayo is 27 years old and can date girls of 20.5 years of age and above
Usman is 36 years old and can date girls of 25.0 years of age and above
Charles is 19 years old and can date girls of 16.5 years of age and above
Kelechi is 23 years old and can date girls of 18.5 years of age and above
Ibibabo is 41 years old and can date girls of 27.5 years of age and above

Mahardika Putra says:

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

for age in range(15,61):
limit = allowed_dating_age(age)
print(‘If you are’,age,’years old’,’-‘,int(limit),’is the youngest you can date’)

Aryan Hegde says:

I am 15 nd my limit is apparently 14.5 thats actually a pretty awesome alg bucky

Lewis Rimmington says:

with ‘return’ it does print the value for me. Is this actually normal?

CyberNerd says:

Code for Challenge at the end of video

def dateage(my_age):
x = 15
girlage = my_age / 2 + 7
return girlage

for x in range(14, 50):
limit = dateage(x)
x += 1
print(x, limit)

Output:

15 14.0
16 14.5
17 15.0
18 15.5
19 16.0
20 16.5
21 17.0
22 17.5
23 18.0
24 18.5
25 19.0
26 19.5
27 20.0
28 20.5
29 21.0
30 21.5
31 22.0
32 22.5
33 23.0
34 23.5
35 24.0
36 24.5
37 25.0
38 25.5
39 26.0
40 26.5
41 27.0
42 27.5
43 28.0
44 28.5
45 29.0
46 29.5
47 30.0
48 30.5
49 31.0
50 31.5

A serious Person says:

It was fairly easy:
def x():
for myAge in range(15,61):
gAge = myAge / 2 + 7
print(myAge, ‘ ‘, gAge)
x()

WilleroGaming says:

def age_limit():
for n in range(15, 60):
print(n/2 + 7)
age_limit()

viki2133 says:

Your personality and way of explaining information make these tutorials very useful, great job!

nigga1683 says:

”’
——————Calculate how many hookers ——————-

Each Pimp has 3 hoes, there is only 5 pimps
Count the total of all the hoes

”’

# define function that has parameter hookers amount

def hoes(hookers_amount):
hookers_count = hookers_amount * 5
return hookers_count

pimp_hoes = hoes(3)
print(“There is a total of”, pimp_hoes, “hoes shared between the pimps”)

Petar Petrovic says:

(‘Bucky’s awesome!!!’) 🙂

Anthony Earls says:

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

for n in range(61):
if n < 15: continue elif n < 61: print(allowed_dating_age(n)) continue else: break