School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 308,426 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 3,233 people online right now. Registration is fast and FREE... Join Now!




Verifying Variables Content

 

Verifying Variables Content

brianmen

19 Jun, 2009 - 07:54 AM
Post #1

New D.I.C Head
*

Joined: 14 Jun, 2009
Posts: 14



Thanked: 1 times
My Contributions
Hello... So I am making a program where I want people to vote on something. I have them answer a question with either an A or a B. I do this using the

CODE
inputtedanswer=raw_input("This is the question, now you should answer A or B")


method. I want to make it so that only answers that are A or B (or even a or b lowercase) can be accepted as answers and not anything else. Is there a way I can do this? Thanks for your help.

User is offlineProfile CardPM
+Quote Post


Posts in this topic
brianmen   Verifying Variables Content   19 Jun, 2009 - 07:54 AM
shadhin   You can try this format- z=raw_input("Ent...   19 Jun, 2009 - 08:08 AM
code_m   another way to write the same thing: line = raw_...   19 Jun, 2009 - 09:12 AM
brianmen   Thanks, I'll try these out!!!   20 Jun, 2009 - 10:49 AM

Fast ReplyReply to this topicStart new topic

Time is now: 11/24/09 01:41PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month