Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Win10 Import math issue
#1
I've just started learning to program. I am running Win10, Python 3.6.4

When I type in the following:
import math
math.sqrt(16)

I save and run it. I get a blank output. I should be getting 4. What am I doing wrong?
Reply
#2
You need print(),when running it as a script.
import math

print(math.sqrt(16))
In interactive console(REPL) example ptpython(work perfect with cmder), IPython.
It will execute without print().
C:\
λ ptpython
>>> import math

>>> math.sqrt(16)
4.0
Reply
#3
Thank you, I'll give it a try. Unfortunately, life is getting in the way of self-teaching / learning time.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Puzzling import issue that I have no idea how to solvr starseeker 3 525 Feb-21-2024, 05:07 PM
Last Post: deanhystad
  math.log versus math.log10 stevendaprano 10 2,427 May-23-2022, 08:59 PM
Last Post: jefsummers
  Where does pip auto install on Win10 with py 3.9.4? Fran_3 4 3,533 May-05-2021, 03:47 PM
Last Post: snippsat
  Why getting ValueError : Math domain error in trig. function, math.asin() ? jahuja73 3 3,783 Feb-24-2021, 05:09 PM
Last Post: bowlofred
  Compiling on win10 ebolisa 1 1,763 Sep-04-2020, 04:39 PM
Last Post: ebolisa
  Error building wheel for grpcio on win10 Topiii 1 5,230 Nov-13-2019, 03:08 PM
Last Post: snippsat
  Development Server Problem (Win10) SMY1 0 1,959 Apr-26-2019, 06:25 PM
Last Post: SMY1
  import psycopg2 issue bhuvneshdogra 1 2,995 Dec-27-2018, 04:03 PM
Last Post: Larz60+
  crypto import issue saisankalpj 2 7,867 Dec-20-2018, 06:08 AM
Last Post: saisankalpj
  win10 Service(script) start and stop hwa_rang098tkd 0 2,467 Jun-21-2018, 07:42 PM
Last Post: hwa_rang098tkd

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020