Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unexpected twice output
#1
Hi guys! given that I'm new to Python and coding in general ...

I have the following code, every 5 seconds I want to print Rysource +100, but the output, as you can see, is printed double:

import time

Rysource = 1000

while True:
    for Rysource in range(Rysource, Rysource+101, 100):
        print(Rysource)
    time.sleep(5)
OUTPUT:
1000
1100
1100
1200
1200
1300
1300
1400


Basically it starts with: 1000,1100. After 5 seconds prints: 1100,1200. After 5 seconds prints: 1200,1300
And so on...
How can i print something like this:

OUTPUT:
1000
1100
1200
1300
1400

I hope this is clear and thank you
Reply


Messages In This Thread
Unexpected twice output - by Samo - Sep-29-2018, 07:36 PM
RE: Unexpected twice output - by buran - Sep-29-2018, 08:13 PM
RE: Unexpected twice output - by gruntfutuk - Sep-29-2018, 08:43 PM
RE: Unexpected twice output - by Samo - Sep-29-2018, 10:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Unexpected output Starter 2 515 Nov-22-2023, 12:08 AM
Last Post: Starter
  Unexpected Output - Python Dataframes: Filtering based on Overlapping Dates Xensor 5 765 Nov-15-2023, 06:54 PM
Last Post: deanhystad
  Unexpected output while using random.randint with def terickson2367 1 544 Oct-24-2023, 05:56 AM
Last Post: buran
  Unexpected output from df.loc when indexing by label idratherbecoding 6 1,257 Apr-19-2023, 12:11 AM
Last Post: deanhystad
  unexpected output asyrafcc99 0 1,523 Oct-24-2020, 02:40 PM
Last Post: asyrafcc99
  Unexpected output: symbols for derivative not being displayed saucerdesigner 0 2,082 Jun-22-2020, 10:06 PM
Last Post: saucerdesigner
  Unexpected output palladium 4 2,784 Jan-11-2020, 03:26 PM
Last Post: palladium
  Unexpected output: if statement CabbageMan 1 1,790 Sep-04-2019, 04:12 PM
Last Post: ThomasL
  Unexpected Output using classes and inheritance langley 2 1,978 Jul-04-2019, 09:33 AM
Last Post: langley
  float multiplication - unexpected output inesk 3 3,381 Dec-11-2018, 10:59 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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