Apr-07-2021, 11:56 AM
(This post was last modified: Apr-09-2021, 02:37 PM by DeaD_EyE.
Edit Reason: solution removed
)
**code removed
Calling a function:
To call
def
is the Keyword for function definition. After this come the name of the function. Then in parentheses the arguments of the function and then the colon.Calling a function:
pint("Hello World")
print
is a function.To call
print_month
:print_month("June", 30)The last piece of code is the f-string:
text1 = "{0} has {1} days".format(month_name, num_days) text2 = "{} has {} days".format(month_name, num_days) text2 = "{name} has {days} days".format(name=month_name, days=num_days) text3 = f"{month_name} has {num_days} days" # but never do: value1 = 42 text4 = "Something " + str(value1) + " something else." # value1 is an int and must be converted to a str, before # it's concatenated with "Something ". This is not very handy. # It's also not good readable # use instead the format method or f-strings.
buran write Apr-08-2021, 05:04 AM:
Please, don't provide answers for those without effort on their part
Please, don't provide answers for those without effort on their part
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!