Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plot a function
#2
The output is right.

You have to look how range(-1, 1, 100) works.
Range starts with -1, then it adds 100 for the next step, then it's compared to end.
If the value is bigger then the end value, then StopIteration is raised.

If you want to have a range like -1, -0.9, -0.8 ... +1, then use a factor.
Range can only handle integer, not floats.

xlist = [x/1000 for x in range(-1000,1000,1)]
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
Plot a function - by dxfrelince - May-21-2019, 09:38 AM
RE: Plot a function - by DeaD_EyE - May-21-2019, 09:48 AM
RE: Plot a function - by dxfrelince - May-21-2019, 10:42 AM
RE: Plot a function - by DeaD_EyE - May-21-2019, 12:23 PM

Forum Jump:

User Panel Messages

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