Funtion issue


Hi there, I need help please. Im doing an exercise about funtions but i don’t understand what’s going on. Here i will show my code and what they are requiring.

my code:

def create_spreadsheet(title):
  print ('creating a spreadsheet called' + 'title'+ '.')
  create_spreadsheet (title = "Downloads")



Define a function called create_spreadsheet() that takes one argument, title , and only prints the string "Creating a spreadsheet called [TITLE]" , where [TITLE] is replaced with the value of title .


Call create_spreadsheet , with a title of "Downloads" .

thank you for your advices :slight_smile:


the function call is nested inside the function, why?


Hi Stetim94. thank you i realized the problem. may i ask u another issue i got regarding this activity please?

i wrote this:

def calculate_age(current_year, birth_year):
  age = current_year - birth_year
  return age

my_age=calculate_age (2018,1993)
print ("I am" + str(my_age) "years old and my dad is" + str(dads_age) "years old")

but I’m getting this msg:

File "", line 7
    print ("I am" + str(my_age) "years old and my dad is" + str(dads_age) "years old")

SyntaxError: invalid syntax

why is this happening? thank you


to insert a variable into a string, there should be a plus sign before and after the variable


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.