I hope you have time to help, despite the deadline for the submission is fast approaching :-)
Essentially, I am struggling with interpreting how to combine the list of endpoints ("en", "dk") with the change_url fkt. Thus, when I simply define char= ["en", "da"] and subsequently run the function, it reads the variable as a string instead of a list, which consequently gives me one wrong output. I would suppose I don't have to use a loop, as we utilize the f-string?
[Uploading Screenshot 2021-07-27 at 10.16.19.png…]()
It seems that you are working on the assingment from last year, doesn't it? How can this be? If this is the case, you can send me an email and we can see if we can sort it out.
Here, you want to loop through each element in your list and use it as argument in your function. So you want to do something like what I do below. Then it's up to you what you do with the output (instead of printing).
Best,
Joachim
for chars in ["en", "da"]:
print(change_url(chars))
Hi Joachim,
I hope you have time to help, despite the deadline for the submission is fast approaching :-)
Essentially, I am struggling with interpreting how to combine the list of endpoints ("en", "dk") with the change_url fkt. Thus, when I simply define char= ["en", "da"] and subsequently run the function, it reads the variable as a string instead of a list, which consequently gives me one wrong output. I would suppose I don't have to use a loop, as we utilize the f-string?
[Uploading Screenshot 2021-07-27 at 10.16.19.png…]()
Kind regards, Frederik :-)
def change_url(chars): url = f"https://www.dst.dk/{chars}/" return url chars=["en", "da"] change_url(chars)
"https://www.dst.dk/['en', 'da']/"