Python Forum

Full Version: A function taking in parameter int and str
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,

I am very new in coding and in Python so my question is probably stupid but nevertheless i'm searching on internet for a solution since hours and i do not find anything that could help me. (I use python 3.7)

I have an this exercice : "Implement a symbol_line function taking an integer N and a character as a parameter and displaying N times the character on the same line"

I write :
def ligne_de_symboles (N, "A"):
    print (N*"A")
But there is a "SyntaxError: invalid syntax" on the "A" so that i can't run my function.
Is there a way to do a function with a str "A" as a parameter ?

English is not my native language and i do not really know what i am talking about but i hope that my question is comprehensible.

Thank you by advance
Parameters have to be variable names, perhaps with an equals and then a default value.

Simple solution: remove all the quotes in the code you posted.