Differences between python terminal run and debug run

Asked 2 years ago, Updated 2 years ago, 171 views

Hello.

I was trying to code Python from linux to vscode, and the result was difficult to understand from simple numbers, so I'm asking you a question.

Is there a difference between python terminal execution and debug execution?

We were analyzing the average by year with daily temperature. If you don't want to run it in the terminal, hit f5 in a row I used to run it in debugger mode The round (divide, 2) function or print (29/4) are all discarded below the decimal point.

Data:

...

2008: [18, 9, 4, 6, 1, 7, 8]

, 2009: [5, 8, 13, 3]

...

Calculation: avgTemperature[year] = round(sum / len(tempList), 3)

Results:

,,, 2003: 5.0, 2004: 1.0, 2005: 19.0, 2006: 2.0, 2008: 8.0, 2009: 7.0}

I tried it just in case

print(round(3.141592, 2)) #3.14

print(round(29/4, 3)) #7.0

print(29/4) #7

print(3/4) #0

I don't know what's wrong with the results.

At the terminal, the same file was found $ Python 3.6 file name.py Floating point works properly when run as (2008: 8.25, 2009: 7.25..) I wonder why this is forced division when you put it in debug mode.

What's wrong with my setting? I can't really feel anything even if I look at _______________________.

And I'm a novice debugger. ☞☜ I thought it was like running a terminal or running a debugger. What's the difference? Can't we express floating point properly in debugging?

python debugger terminal float

2022-09-22 20:27

1 Answers

Check out the Python version first.

And cpu doesn't really represent floating point operations.

https://ko.wikipedia.org/wiki/IEEE_754

Handling Floating Points in Python

https://winterj.me/Floating-Point/


2022-09-22 20:27

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.