#Sam Ola
#10/4/2021
#In this lesson i learned how to create functions with a return value
#i had a big difficulty with how to phrase it but i got it in the end
# Message double returns the string Argument doubled
def msg_double(phrase):
double = phrase + " " + phrase
return double
# save return value in variable
msg_2x = msg_double("let's go")
print(msg_2x)
# example of functions with return values used in functions
def msg_double(phrase):
double = phrase + " " + phrase
return double
# prints the returned object
print(msg_double("Save Now!"))
# echo the type of the returned object
type(msg_double("Save Now!"))
def make_doctor(name):
full_name = input("Insert your name:")
return full_name
print("The doctor's name is Dr.")
print(make_doctor("Insert your name:"))
def make_schedule(period1, period2):
schedule = ("[1st] " + period1.title() + ", [2nd] " + period2.title())
return schedule
student_schedule = make_schedule("mathematics", "history")
print("SCHEDULE:", student_schedule)
def make_schedule(period1, period2, period3, period4, period5, period6):
schedule = ("[1st] " + period1.title() + ", [2nd] " + period2.title() + ", [3rd] " + period3.title() + ", [4th] " + period4.title() + ", [5th] " + period5.title() + ", [6th] " + period6.title())
return schedule
student_schedule = make_schedule("mathematics", "history", "Science", "English", "Python", "Gym")
print("SCHEDULE:", student_schedule)