Im having an issue with string substitution randomquote and

I\'m having an issue with string substitution.

*** randomquote and randompic are both indexes of lists set to variables.

***there IS tab before the print(\"\"\" it just won\'t show up when I post the question.

Here is what I have:

print(\"\"\"

<html>
<head>
<title>Quote and Image of the Day of Mario Batali</title>
</head>


<body>
Quote: %s
Pic: <img src \'%s\' width = 100 height = 7>

</body>
</html>

\"\"\" %s = (randomquote, randompic))

I keep getting an error with the %s = (randomquote, randompic)) saying that it \"Keyword can\'t be an expression\"

Can someone suggest an alternative to help get past this? Thanks

Solution

\"\"\"

Remove %s at the end of the print statement.

I have taken some sample input\'s for randomquote and randompic, you can remove that.

\"\"\"

randomquote = \"Hello World!\"
randompic = \"PIC\"
print(\"\"\"
<html>
<head>
<title>Quote and Image of the Day of Mario Batali</title>
</head>

<body>
Quote: %s
Pic: <img src \'%s\' width = 100 height = 7>
</body>
</html>
\"\"\" %(randomquote, randompic))

\"\"\"

sample output

\"\"\"

I\'m having an issue with string substitution. *** randomquote and randompic are both indexes of lists set to variables. ***there IS tab before the print(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site