Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beginner Assistance
#6
Whenever you have issues with code, please provide the minimum, runnable code to reproduce the problem as well as the input you're giving to reproduce the problem. For example, here's the code I'm using that appears to work
VC1 = {1, 2, 3, 4, 5}

def test():
   D9 = int(input())
   while D9 not in VC1:
       print ("That is not a correct value. Try again.")
       D9 = int(input())
   else:
       print ("You selected", D9)
Interactive session showing use:
Output:
>>> test() 10 That is not a correct value. Try again. -1 That is not a correct value. Try again. 0 That is not a correct value. Try again. 7 That is not a correct value. Try again. 6 That is not a correct value. Try again. 1 You selected 1 >>> test() 2 You selected 2 >>> test() 3 You selected 3 >>> test() 4 You selected 4 >>> test() 5 You selected 5
Reply


Messages In This Thread
Beginner Assistance - by liamwemyss - Jun-07-2017, 05:51 PM
RE: Beginner Assistance - by micseydel - Jun-07-2017, 06:13 PM
RE: Beginner Assistance - by liamwemyss - Jun-07-2017, 07:20 PM
RE: Beginner Assistance - by micseydel - Jun-07-2017, 07:24 PM
RE: Beginner Assistance - by liamwemyss - Jun-07-2017, 07:32 PM
RE: Beginner Assistance - by micseydel - Jun-08-2017, 12:48 AM
RE: Beginner Assistance - by micseydel - Jun-08-2017, 12:52 AM
RE: Beginner Assistance - by liamwemyss - Jun-08-2017, 01:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Big Grin Beginner - Assistance please Elippsis007 4 3,013 Nov-20-2020, 03:31 PM
Last Post: Elippsis007

Forum Jump:

User Panel Messages

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