I'm taking a Python intro course and couldn't solve this problem.
Make this string correct and store it in a variable named 'q12'.
q12 = "4 % 2 = " + (4 % 2))
Any help would be much appreciated!
I'm taking a Python intro course and couldn't solve this problem.
Make this string correct and store it in a variable named 'q12'.
q12 = "4 % 2 = " + (4 % 2))
Any help would be much appreciated!
There are many ways, the simplest is to use the f-format, you put f before the string and curly braces around expresions:
>>> def q( m, n): return f"{m} % {n} = {m%n}"
...
>>> q( 53, 22)
'53 % 22 = 9'