'How to get to a new line in Python Shell?

In IDLE, say i want to write the following in TWO lines:

x = 3

print x**5

but when i type x = 3 and press enter, it executes the assignment. How to let it execute AFTER two lines are all typed in?

having read first pages of Python tutorial but no answer to this "funny" question...



Solution 1:[1]

Use the Ctrl-J key sequence instead of the Enter key to get a plain newline plus indentation without having IDLE start interpreting your code.

You can find other key sequences that make IDLE easier to use for this type of learning under the Options->Configure IDLE menu.

Solution 2:[2]

after every line put \ mark and press enter

Solution 3:[3]

To code group of statements, ;\ will work

   list1=[1,2,3]
   list2=[4,5,6]

   print list1;\
   print list2

Will print both the lists

Where as, for Indentation statement, you need :\

  for i in list1:\
  print i
  //double enter

Will show all the elements in the list

Solution 4:[4]

x = 3; print x ** 5

should help, but it doesnt matter that its executed the way it is in IDLE.

Solution 5:[5]

Just open a new file: File > New window. You can run it by clicking run > run module.

Solution 6:[6]

the "\" line at the end of the line works for me. in windows 10 cmd.

Edit: I've also noticed that you have to be consistent with its use, other wise you still get syntax error

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 phihag
Solution 2 Parivesh
Solution 3 Hearaman
Solution 4 rajasaur
Solution 5 Jonathan
Solution 6