0

How to get the defined string printed?

def my_func(): print("spam") print("spam") print("spam") str("john") print(str()) my_func() how to get the string "John" gets printed?

29th Jul 2016, 10:41 PM
Nitin
3 Antworten
+ 1
Instead of str("john") use str="john" print(str)
30th Jul 2016, 12:56 AM
Max Pickup
Max Pickup - avatar
+ 1
yes, I agree with "Max Pickup." that would be the only way to print that string (firstly, you need to make it a string.)
1st Aug 2016, 12:50 PM
James 'the bunyip' Ringhof
James 'the bunyip' Ringhof - avatar
- 2
I don't think you can.
30th Jul 2016, 12:13 AM
Narek Tonoyan
Narek Tonoyan - avatar