title: Executing multi-line statements in python in interactive mode
body: <p>I am new to the world of Python, and this is my first program in Python. I come from the world of R so this is a bit unintuitive to me. </p>
  
  <p>When I execute </p>
  
  <pre><code>In[15]: import math
     ...: import random
     ...: random.random()
     ...: math.sqrt(85)
     ...: 
  </code></pre>
  
  <p>in interactive mode (i.e. on <code>&gt;&gt;&gt;</code> prompt), I get the output of <code>math.sqrt()</code>. I don't see the random number at all. However, when I execute <code>random.random()</code> and <code>math.sqrt()</code> separately, I do get both the results. Why is this? How do I get both the results? I am asking this because I have the habit of selecting multiple lines in R and executing them in interactive mode, especially when I am trying to debug code. Executing only one line at a time will be excruciating when trying to debug, say, 2000-line code. </p>
  
  <p>Here's what happens when I select multiple lines in R and then execute them:</p>
  
  <pre><code>runif(1,0,1)
    sqrt(85)
  </code></pre>
  
  <p>It automatically parses these lines and generates the following output:</p>
  
  <pre><code>&gt; runif(1,0,1)
  [1] 0.01597949
  &gt;   sqrt(85)
  [1] 9.219544
  </code></pre>
  
  <p>I researched on SO and found <a href="https://stackoverflow.com/questions/46461251/write-multi-line-statement-on-single-line">Write multi-line statement on single line</a>. I am unsure how to use the official answer from this thread.</p>
  
  <hr>
  
  <p>Here's the output on PyCharm:</p>
  
  <pre><code>import math
  import random
  random.random()
  math.sqrt(85)
  Out[15]: 9.219544457292887
  </code></pre>
  
  <p>I am looking for some mechanism to see a random number and the sqrt of 85 without having to add any separator <code>,</code> or <code>;</code>, as I did in R code. I'd appreciate any thoughts.</p>
  
  <p><strong>Expected Input:</strong> One would run the code using "Execute Selection using Console" in PyCharm [Keyboard Shortcut: Alt + Shift + E]</p>
  
  <pre><code>import math
  import random
  random.random()
  math.sqrt(85)
  </code></pre>
  
  <p><em>[Please note that I haven't used any separator ";" or ","--just as we do in R]</em></p>
  
  <p><strong>Expected Output:</strong></p>
  
  <pre><code>random.random()
  Out[16]: 0.183145720117748
  math.sqrt(85)
  Out[17]: 9.219544457292887
  </code></pre>