2021年4月7日星期三

I am learning python - Why Single quotation marks and code syntax is printed in my terminal?

Why Single quotation marks and code syntax is printed in my terminal?

I wrote this code in my tutorial file:

var1 = "hello"  print(var1)  print(type(var1))    var2 = """Peter Piper picked a peck of pickled peppers.    A peck of pickled peppers Peter Piper picked.    If Peter Piper picked a peck of pickled peppers?    Where's the peck of pickled peppers Peter Piper picked?  """+"""              The""",var1,""" end"""  print(var2)  

But when I run my code in my terminal It showed this:

  hello  <class 'str'>  ('Peter Piper picked a peck of pickled peppers.\n\nA peck of pickled peppers Peter Piper picked.\n\nIf Peter Piper picked a peck of pickled peppers?\n\nWhere's the peck of pickled peppers Peter Piper picked?\n              The', 'hello', ' end')  

I wanted it to print this:

hello  <class 'str'>  Peter Piper picked a peck of pickled peppers.    A peck of pickled peppers Peter Piper picked.    If Peter Piper picked a peck of pickled peppers?    Where's the peck of pickled peppers Peter Piper picked?                    The hello end  

I don't know how to fix it Please help me

https://stackoverflow.com/questions/66996817/i-am-learning-python-why-single-quotation-marks-and-code-syntax-is-printed-in April 08, 2021 at 11:06AM

没有评论:

发表评论