Python Forum
Printing During a Loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Printing During a Loop
#11
Can you make a screenshot of the code you run?
(Oct-20-2021, 02:50 PM)apeltes Wrote: I used Word to work on the code at one point because Python Idle kept timing out
I don't know what you mean that IDLE "kept timing out".
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#12
Ok. I tried running my code at https://www.online-python.com/ and it works fine.

When I run it in the "Python Idle" tool that my class uses, it does NOT run correctly. All of the output happens at one time when the program is done.

And just for fun, I copied some "curvy" quotation marks from Word and pasted them into my code... and it still runs. No syntax errors.

So am I using some kind of junky version of Python? This is a Florida Virtual School class, by the way. The Python Idle tool is built into the class and opens in a browser window.
Python Idle is a tool that opens from inside the course. In its own window. If I work in there for too long and try to save my code, I get an error message and lose my work. So now I type my code in Word and paste it onto Python Idle to test it. It's a real pain.

(Oct-20-2021, 02:56 PM)buran Wrote: Can you make a screenshot of the code you run?
(Oct-20-2021, 02:50 PM)apeltes Wrote: I used Word to work on the code at one point because Python Idle kept timing out
I don't know what you mean that IDLE "kept timing out".

No. I'm running the code I posted. I'm not trying to fool anyone. I think the issue is with the "Python Idle" tool my class uses.

I attached a screen shot.

(Oct-20-2021, 10:10 AM)buran Wrote: It's obvious that you run something [completely] different from what you post - i.e. with the incorrect quotes it will not run at all and you haven't noticed them, the different output you claim, etc.


.pdf   PDF.pdf (Size: 73.67 KB / Downloads: 100)
Reply
#13
So, first of all, this is not IDLE. It says Python IDLE, but in fact it's misleading. In python world IDLE normally refers to a very basic desktop software, written with python and tkinter, that comes with python. It is included with Windows distribution, but has to be installed on Linux and I guess - on Mac. I guess they use the name because it stands for Integrated Development and Learning Environment, but again, it's confusing.

What you have is some sort of online IDE/REPL (Read–eval–print loop). That's why it timed out. And I guess they perform some fix/replace for the quotes behind the scene before they run the code. Probably that is also the reason why there is some delay when present the output. We cannot say more because we don't see the body of the loop, nor we know the specific online tool.

I would advise that you work offline in a IDE (even you can use the real IDLE, although it's considered poor IDE) and test/try your code.
You can use https://replit.com/languages/python3 if you want to test in different online environment.

EDIT
I see, you have tried https://www.online-python.com/
There it will raise error with incorrect quotes. Same in https://replit.com
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#14
(Oct-20-2021, 03:19 PM)apeltes Wrote: I'm running the code I posted. I'm not trying to fool anyone.
We/I don't think you would do such thing by purpose. It happens with new users that they edit the code but don't save or run different file (if they have multiple files, etc.). Now we know for sure it's problem with the online tool you use.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#15
Thank you very much! I will start using a different tool to test my code from now on. I'm a little annoyed that they have us using something that doesn't work correctly. I guess they wanted to make it more simple?

Anyway, I think I understand and I appreciate the help.

(Oct-20-2021, 04:08 PM)buran Wrote:
(Oct-20-2021, 03:19 PM)apeltes Wrote: I'm running the code I posted. I'm not trying to fool anyone.
We/I don't think you would do such thing by purpose. It happens with new users that they edit the code but don't save or run different file (if they have multiple files, etc.). Now we know for sure it's problem with the online tool you use.
Reply
#16
I pasted your original code into IDLE and it failed with a syntax error because of the quotes.
Fixed the quotes and it runs fine in IDLE
Reply
#17
Yes. I fixed the quotes and used https://www.tutorialspoint.com/execute_p...online.php

It works fine. So I'm going to stop using the tool that's supposed to be "Python Idle" that they have linked to my class. It was letting me use the wrong type of quotation marks and it doesn't produce output when it should. Very annoying.


(Oct-20-2021, 08:03 PM)jefsummers Wrote: I pasted your original code into IDLE and it failed with a syntax error because of the quotes.
Fixed the quotes and it runs fine in IDLE
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with for-loop printing. I want it to print only once. blacklight 2 6,948 Jun-26-2020, 02:23 AM
Last Post: pyzyx3qwerty
  My Loop for printing text file goes to infinity Nomex 7 4,221 Feb-10-2020, 03:13 PM
Last Post: buran

Forum Jump:

User Panel Messages

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