Python Forum
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Variable Range
#2
The input function returns either a string (3.0+) or a number (if you enter one in 2.7 or before). The range function returns either a range object (3.0+) or a list (2.7-). None of those comparisons work.

Are you trying to get a random number that the user then guesses? If so, look at the random module, either random.randrange or random.randint.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Variable Range - by Trinx - Jan-10-2019, 03:11 AM
RE: Variable Range - by ichabod801 - Jan-10-2019, 03:23 AM
RE: Variable Range - by Trinx - Jan-10-2019, 03:29 AM
RE: Variable Range - by Larz60+ - Jan-10-2019, 03:40 AM
RE: Variable Range - by Trinx - Jan-10-2019, 03:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  matplotlib x axis range goes over the set range Pedroski55 5 3,278 Nov-21-2021, 08:40 AM
Last Post: paul18fr
  Define a range, return all numbers of range that are NOT in csv data KiNeMs 18 7,153 Jan-24-2020, 06:19 AM
Last Post: KiNeMs
  Would like to input a date variable and determine whether it is within the time range harold 3 2,610 Jan-05-2019, 09:04 AM
Last Post: Gribouillis
  Variable in range of float dogginky 3 3,470 Dec-27-2017, 02:36 PM
Last Post: Larz60+
  Modifying / extracting multiple list items simultaneously using variable from range ehammarlund 4 3,748 Dec-06-2017, 08:15 PM
Last Post: ehammarlund

Forum Jump:

User Panel Messages

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