+ 3
What happens here...??
I came accross this nd it looks strange.. while.... print("\nspam" * 3)or print("spam\n" * 3) prints the desired output as... spam spam spam (with the newlines in the respective places for both i.e. \n bfre and after the text) But... print("\tspam" * 3) or print("spam\t" * 3) doesn't give the desired output.. it prints.. spamspamspam and spamspamspam it at least prints the tab space once for the former one but nothing for the later.. I expected spam spam spam spam spam spam
7 Réponses
+ 1
It does give you the desired outputs. What are you talking about?
Here’s a copy paste of the code: http://www.sololearn.com/app/JUMP_LINK__&&__python__&&__JUMP_LINK/playground/c0EaKE3akpAF/
+ 3
It prints spam as a tab indent or as new line.
+ 1
It does work
+ 1
yeah it works but the INDENTATION on the output that has to be printed coz of \the (tab space).. tats wat am talking about. I explained in the last part of my question..
by the way.. are u using a PC or a Mobile? ? it shows this way on my phone..
+ 1
I’m on a iPad
+ 1
okay maybe the interpreter on the phone is faulty.. I suppose this will work fine on a PC..
this works fine with
print("\tspam\t"*3)
but not wat I mentioned in the question.. it's about the interpreter..
+ 1
Janet Jane yeah it is supposed to print it with newlines or tab spaces for \n and \t respectively. .
but the interpreter for the android phones provided by sololearn is kinda faulty.. maybe..