Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Learning Loops
#11
(Oct-06-2016, 12:25 PM)BobA Wrote:
(Oct-06-2016, 11:24 AM)Larz60+ Wrote: Hello,

I take responsibility for that. I made a mistake. code should be:

for x in range (10):
    for y in range (21):
        print(x)
        print(y)
print('\n')

I don't know what's  going on.  If I run the above code it looks like this:

Not sure whats going on, if I may take the liberty of modifying Larz60+'s code a bit to
for x in range (10):
    for y in range (21):
        print("x = ", x)
        print("y = ", y)
print('\n' + 'new line')
I get the following results
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#12
Guy's you don't need to post 400 lines output to get the point across :-/
Reply
#13
(Oct-06-2016, 01:38 PM)snippsat Wrote: Guy's you don't need to post 400 lines output to get the point across :-/

I tried to edit it it down, but it didn't take for some reason. Did you use the "spoiler button" to change it to a link?
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#14
(Oct-06-2016, 01:41 PM)sparkz_alot Wrote:
(Oct-06-2016, 01:38 PM)snippsat Wrote: Guy's you don't need to post 400 lines output to get the point across :-/

I tried to edit it it down, but it didn't take for some reason. Did you use the "spoiler button" to change it to a link?

Never mind, found the answer in the Help documents.  :shocked:
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#15
(Oct-06-2016, 08:59 AM)BobA Wrote:
(Oct-05-2016, 05:01 PM)Yoriz Wrote: Please post the code that was run to produce the output shown because the code in the first post would not produce the output shown (unless you have just not copied all of the output and cut the beginning off)

I copied the code from post 1 in this thread and ran it in Visual Studio.  I've run it several times with the same result.

Here is the code again.

for x in range (0,10):
    for y in range (1,21):
        print(x)
        print(y)
print('\n')

Visual studio is most likely clipping the output, you might be able to find a setting to alter how many lines it will display before it over writes the oldest lines.
Reply
#16
(Oct-06-2016, 04:50 PM)Yoriz Wrote: Visual studio is most likely clipping the output, you might be able to find a setting to alter how many lines it will display before it over writes the oldest lines.

OK, thanks all for the help.  I am a total beginner.  Once I get a few of the "learning curve" things under my belt, I suspect I'll be off and running.

My problem, obviously is with Visual Studio.  In PyCharm the code works fine and in Visual Studio if I go to Python 64 bit 3.5 interactive and paste the code there it works fine.

But when I do things using the console (I think) where it brings up a DOS like window with output, then that's where everything gets screwed up, and I get these crazy outputs.

I've been searching, and looking around, but I have no idea how to fix it.

Anyway, I appreciate everybody's patience.
Reply


Forum Jump:

User Panel Messages

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