How to get to a new line in Python Shell?

Viewed 105024

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...

8 Answers

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

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

Related