Python Forum
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inputting a varible
#2
Your if statement has nothing to do with your question
From your question, I would expect the input to be either rade of spam.
if you want to input an integer I would suggest:
try:
   choice = 0
   while choice not = 1 and choice not = 2:
       choice = int(input('Please enter 1 for rade, 2 for spam: ))
except ValueError:
   print('Requested 1 or 2')
Reply


Messages In This Thread
Inputting a varible - by BlathaBlather - Apr-05-2017, 06:24 PM
RE: Inputting a varible - by Larz60+ - Apr-05-2017, 06:29 PM
RE: Inputting a varible - by wavic - Apr-05-2017, 06:34 PM
RE: Inputting a varible - by Ofnuts - Apr-05-2017, 08:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  local varible referenced before assignment SC4R 6 1,599 Jan-10-2023, 10:58 PM
Last Post: snippsat
  Python 3.8 Nested varible not updating Teknohead23 6 2,521 Oct-02-2021, 11:49 AM
Last Post: Teknohead23
  Unable to understand how given code takes a fixed input value, without inputting. jahuja73 4 2,789 Jan-28-2021, 05:22 PM
Last Post: snippsat
  Argparse error when inputting values tqader 2 2,950 Sep-11-2020, 07:42 PM
Last Post: buran
  Letters with Accents Not Inputting Phylus 0 1,489 Jun-12-2019, 04:05 PM
Last Post: Phylus

Forum Jump:

User Panel Messages

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