+ 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

21st May 2018, 7:28 PM
Vishwak
Vishwak - avatar
7 Answers
+ 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/
21st May 2018, 8:09 PM
Hampus Mathiesen
Hampus Mathiesen - avatar
+ 3
It prints spam as a tab indent or as new line.
22nd May 2018, 1:41 AM
Apple Blossom
Apple Blossom - avatar
+ 1
It does work
21st May 2018, 8:11 PM
Hampus Mathiesen
Hampus Mathiesen - avatar
+ 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..
21st May 2018, 8:13 PM
Vishwak
Vishwak - avatar
+ 1
I’m on a iPad
21st May 2018, 8:32 PM
Hampus Mathiesen
Hampus Mathiesen - avatar
+ 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..
21st May 2018, 8:35 PM
Vishwak
Vishwak - avatar
+ 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..
22nd May 2018, 8:03 AM
Vishwak
Vishwak - avatar