0
def list_toPrint(list_a):
    print(list_a)
    return "hello"
list_toPrint([1,2,3,4]) #the 2nd line is 'hello'

-When calling a function, the string is with ''
[1,2,3,4]
'hello'

def list_toPrint(list_a):
    print(list_a)
    return "hello"
print(list_toPrint([1,2,3,4])) #the 2nd line is hello without ''

-When printing a function, the string is without ''
[1,2,3,4]
hello

1.Why is that?
2.What's the rule for having a string with/without '' in python?

ANEN
  • 11
  • 1

0 Answers0