My madlib will run in the terminal, but when I input things for verbs and adjectives it doesn’t run with them in. Please help.
adj = input(“adjective”)
verb= input(“verb”)
Madlib= “I love to {verb} code, it can become a {adj} skill”
Print(Madlib)
It comes out in the terminal of visual studio code correctly, it just doesn’t work after I put stuff in for adjectives and verb
3
Answers
you should use
f-string
and try this way:output:
Begin your string (the text surrounded by ") with f.
So, your code should be
It is also good practice to begin variables with a lowercase letter (e.g., Madlib => madlib).
In Python it is not the same thing as we do in Javascript, you either add an "f" before the quotes, or you can simply concatenate strings:
PS: In Python, variables’ first letter should be in lowercase.