I am trying to make a program with multiple choice questions and unfortunalty i don't know how to write the code for it
so please help me
thanx




Posted 08 June 2009 - 01:41 PM
Posted 09 June 2009 - 09:01 PM
Posted 13 July 2009 - 09:36 PM
#start
name=raw_input( "what is you name (press enter after inputting ANY data)?")
print 'Hello there', name, 'thank you for interacting with me! My name is PC and I am your Automated-Entertainer today!'
print \
"""I am going to ask you a few questions to find out if I can find out your integrity level.
Please answer as best as you can with either a : '1', '2', or '3'. (remember to press enter after your entry)
"""
raw_input('\n\n\t\t\tPress enter to begin the test')
#question section
print \
"""
Question #1
You walk into a bank and see a $100 note on the floor.
Do you:
1) Give it to the teller operator
2) Look around before picking it up and only give it back if someone sees you
3) Pick it up no matter what and run like mad before some chases you
"""
q1=int(raw_input('\nWhat would you do 1, 2, or 3?'))
if q1=="1":
print "great response"
elif q1=="2":
print "great response"
elif q1=="3":
print "goodo"
else:
print"\n I said 1, 2 or 3."
int(raw_input('\nWhat would you do 1, 2, or 3?'))
#*******************************************************this is where i am stuck********************************************************
print "\n\t\tHmmmm, very interesting. I need extra time to compute that!"
raw_input('\n\n\t\tPress enter to continue the test')
print \
'''
Well after that response I better think of something more questionable!
Question #2
If You had access to a computer at work (that was not monitored) and you saw a web site offering free downloads of
the latest movie that you haven't seen yet,
Do you:
1) Report the web site to the network administrator.
2) Download it and tell no one.
3) Download it and burn it to a DVD and then sell copies of it for $10.00 to work colleages.
'''
q2=int(raw_input('\nWhat would you do, 1, 2 or 3?'))
print "\n\t\tYou would do what?", name," I can't believe that you would do that! My information says otherwise..."
raw_input('\n\n\t\tPress enter to continue the test')
print \
'''
Question #3
After a delightful shopping experience at Safeway, you get home and discover that you did not pay for an item.
Do you:
1) Call the store and let them know you will pay for the item next time you are in shopping.
2) Forget about it as they make millions of dollars in profit anyway
3) Devise ways that you can use to steal more the next time you shop.
'''
q3=int(raw_input('What would you do 1, 2, or 3?'))
print "\n\t\tYep sounds like that you would do that to!"
raw_input('\n\n\t\tPress enter to continue the test')
print \
'''
Okay lets look at Question #4
You just filled your car up at pump 4 and it cost you $98.45 in fuel. When you go to pay the attendant says
'pump 3, that will be $13.89'.
Do you:
1) Correct the attendent
2) Pay for it ($13.89) and only correct the attendent IF you see the person from pump 3 in the line
3) Pay ($13.89) and run as fast as you can and burn black rubber all the way out of there never to return!
'''
q4=int(raw_input('What would you do?'))
print "\n\tHmmmm, very interesting. I need extra time to compute that answer also!"
raw_input('\n\tPress enter to continue')
print '\n\t Well after calculating your responses, I must say that I AM VERY SURPRISED WITH YOU!'
print "\n\tNever in my day have I ever had well, I can't finish that :( !"
raw_input('\n\n\t\tPress enter to continue ')
total= q1 * q2 * q3 * q4 * 2
print 'I have given you a number based on your resposes ' ,name, ', your respose value is ', total
print \
'''
Rate your score against here
0 - 20 = Very honest! You must be an angel (ฟ)
21 - 50 = Just a few choices you may need to re think, otherwise, well done! *:..:*จจ*:..:*
51 - 99 = Well at least you honest in your resposes! .:*จจ*:.
100 + = I think your name was on Australia most wanted!
'''
raw_input("\n\nPress the enter key to exit.")
Posted 17 July 2009 - 11:28 AM
def questionOne():
print \
"""Question #1
You walk into a bank and see a $100 note on the floor.
Do you:
1) Give it to the teller operator
2) Look around before picking it up and only give it back if someone sees you
3) Pick it up no matter what and run like mad before some chases you
"""
q1=input("\nWhat would you do 1,2, or 3? ")
if q1 == 1:
print("Great response.")
elif q1 == 2:
print("Great response.")
elif q1 == 3:
print("Goodo")
else:
print("\nI said 1, 2 or 3.")
questionOne() #if the user decides to input anything that isnt 1, 2 or 3 this makes the question start
#over again.
questionTwo()#if everything goes correctly this calls the next question
def questionTwo():
print \
"""
Well after that response I better think of something more questionable!
Question #2
If You had access to a computer at work (that was not monitored) and you saw a web site offering free downloads of
the latest movie that you haven't seen yet,
Do you:
1) Report the web site to the network administrator.
2) Download it and tell no one.
3) Download it and burn it to a DVD and then sell copies of it for $10.00 to work colleages.
"""
q2=input("\nWhat would you do 1, 2 or 3?")
print "\n\t\tYou would do what?", name," I can't believe that you would do that! My information says otherwise..."
questionThree()#this calls the next question
def questionThree():
#code goes in here
#then call the next function, which would be questionFour
def questionFour():
#code goes here
name = raw_input("What is your name (press enter after inputting ANY data)? ")
print('Hello there', name, 'thank you for interacting with me! My name is PC and I am your Automated-Entertainer today!')
print \
"""I am going to ask you a few questions to find out if I can find out your integrity level.
Please answer as best as you can with either a : '1', '2', or '3'. (remember to press enter after your entry)
"""
raw_input("\n\n\t\t\tPress enter to begin test.")
questionOne()#this begins the questions by calling the first question
This post has been edited by FreezingDigits: 17 July 2009 - 11:35 AM
Posted 20 July 2009 - 12:34 AM
cjcamsta, on 13 Jul, 2009 - 08:36 PM, said:
...
q1=int(raw_input('\nWhat would you do 1, 2, or 3?'))
if q1=="1":
print "great response"
elif q1=="2":
print "great response"
elif q1=="3":
print "goodo"
else:
print"\n I said 1, 2 or 3."
int(raw_input('\nWhat would you do 1, 2, or 3?'))
#*******************************************************this is where i am stuck********************************************************
'''
choice = raw_input("choose 1, 2 or 3.")
while choice not in ["1", "2", "3"]:
choice = raw_input("choose 1, 2 or 3.")
choice = raw_input("choose 1, 2 or 3.")
while choice not in ["1", "2", "3"]:
choice = raw_input("choose 1, 2 or 3.")
reaction = {"1": "great response", "2": "great response", "3": "goodo"}
print "Your choice was " + choice
print "This is " + reaction[choice]
q1=input("\nWhat would you do 1,2, or 3? ")
if q1 == 1:
This post has been edited by Nallo: 20 July 2009 - 12:38 AM
Posted 20 July 2009 - 10:50 PM
q1=input("\nWhat would you do 1,2, or 3? ")
q1=int(input("\nWhat would you do 1,2, or 3? "))
This post has been edited by FreezingDigits: 20 July 2009 - 10:51 PM
Posted 21 July 2009 - 02:02 AM
q1=input("\nWhat would you do 1,2, or 3? ")
if q1 == "1"
...
Posted 21 July 2009 - 12:11 PM
Posted 21 July 2009 - 12:47 PM
Nallo said:
try:
foo = int(raw_input("bar"))
except ValueError:
foo = 0
This post has been edited by Oler1s: 21 July 2009 - 12:47 PM
Posted 21 July 2009 - 01:41 PM
Posted 22 July 2009 - 08:00 PM
#start
print "\t\tWelcome my friend!"
namecheck='fail'
while namecheck=="fail":
name=raw_input( "Hello. Can I first of all have your name (press enter after inputting ANY data)?")
if len(name)>1:
namecheck="pass"
else: "\nHey man, I said enter your name THEN press the enter key!.....sheeeezzzzz"
print '\nHello there', name, 'thank you for interacting with me! My name is PC and I am your Automated-Entertainer today!'
print \
"""I am going to ask you a few questions to find out if I can find out your integrity level.
Please answer as best as you can with either a : '1', '2', or '3'. (Remember to press enter after your entry)
"""
raw_input('\n\n\t\t\tPress enter to begin the test')
# if I change q1 to: q1=raw_input, then it wont accept any value, num or lett, and be in a continous loop
#question section
print "Question #1"
print name, "you walk into a bank and see a $100 note on the floor."
print \
"""
Do you:
1) Give it to the teller operator
2) Look around before picking it up and only give it back if someone sees you
3) Pick it up no matter what and run like mad before some chases you
"""
ok='no'
while ok== 'no':
q1=int(raw_input('\nWhat would you do 1, 2, or 3? '))
if q1 ==1:
ok='yes'
print "\nwell ok then!", name
elif q1 ==2:
ok='yes'
print "\nIf only your mother knew", name
elif q1==3:
ok='yes'
print "\nwhat the????"
print "\n\t\tHmmmm, very interesting,",name+ "! I need extra time to compute that!"
raw_input('\n\n\t\tPress enter to continue the test')
#question 2
print 'Well after that response,',name,'I better think of something more questionable!'
print 'Question #2'
print"\n\nIf You had access to a computer at work (that was not monitored) and you,",name,"saw a web site offering free downloads of the latest movie that you haven't seen yet,"
print name, "Do you:"
print \
'''
a
1) Report the web site to the network administrator.
2) Download it and tell no one.
3) Download it and burn it to a DVD and then sell copies of it for $10.00 to work colleages.
'''
ok='no'
while ok== 'no':
q2=int (raw_input('\nWhat would you do 1, 2, or 3? '))
if q2 ==1:
print "\nThat is quite nice of you,",name,"!"
ok='yes'
elif q2 ==2:
print "\nIf only your mother knew",name+ "!!!! I can't believe that you would do that! My information says otherwise..."
ok='yes'
elif q2==3:
print "\nWhat the????",name+ ", now my central processing unit is overclocking!"
ok='yes'
raw_input('\n\n\t\tPress enter to continue the test')
#question 3
print "\nQuestion #3"
print "\n\nAfter a delightful shopping experience at Safeway,",name,"you get home and discover that you did not pay for an item."
print name,"do you:"
print \
'''
1) Call the store and let them know you will pay for the item next time you are in shopping.
2) Forget about it as they make millions of dollars in profit anyway
3) Devise ways that you can use to steal more the next time you shop.
'''
ok='no'
while ok== 'no':
q3=int (raw_input('\nWhat would you do 1, 2, or 3? '))
if q3 ==1:
print "\nThat is really going the extra mile",name
ok='yes'
elif q3 ==2:
print "\nMakes me think of what you would think if you own the store,", name+"."
ok='yes'
elif q3==3:
print "\nI am not going shopping with you!", name
ok='yes'
print "\n\t\tAnd it does sound like that you," ,name+ ", would do that to!"
raw_input('\n\n\t\tPress enter to continue the test', )
#question 4
print"\nOkay lets look at Question #4", name
print"\n\nYou just filled your car up at pump 4 and it cost you $98.45 in fuel. When you go to pay the attendant says 'pump 3, that will be $13.89'."
print name, "Do you:"
print\
"""
1) Correct the attendent
2) Pay for it ($13.89) and only correct the attendent IF you see the person from pump 3 in the line
3) Pay ($13.89) and run as fast as you can and burn black rubber all the way out of there never to return!
"""
ok='no'
while ok== 'no':
q4=int (raw_input('\nWhat would you do 1, 2, or 3? '))
if q4 ==1:
print "\nwell ok then!"
ok='yes'
elif q4 ==2:
print "\n",name,"I hope big brother is watching you all the time!"
ok='yes'
elif q4==3:
print "\n",name,"you cheap so & so. I hope Karma gets you!"
ok='yes'
print "\n\tThank you", name,"for choosing wisely. I see great things coming your way"
raw_input('\n\tPress enter to continue')
print '\n\tWell after calculating your responses',name,' I must say that I AM VERY SURPRISED WITH YOU!'
print "\n\tNever in my day have I ever had well, I can't finish that :( !"
raw_input('\n\n\t\tPress enter to continue')
total= q1 + q2 + q3 + q4 + 2
if total==6:
print name, "I believe you are an honest person! Good on you (ฟ)"
if total ==7:
print name, "great job! (ฟ)"
elif total ==8:
print "good job (ฟ)"
elif total==9:
print name, " not bad, you are just may need to rethink some choices *:..:*จจ*:..:*"
elif total==10:
print name, "...well you are at least honest! *:..:*จจ*:..:*"
elif total ==11:
print name, "I think you are an excon! .:*จจ*:."
elif total >11:
print name, "your IP address has been submitteed to the Australian Federal Police .:*จจ*:."
else:
print name,"thank you for trying to do this test. Maybe following instructions like inputting 1, 2 or 3 is to much for you. *:..:*จจ*:..:*.:*จจ*:.*:..:*จจ*:..:*"
print"\n\nThankyou for your time"
raw_input("\n\nPress the enter key to exit.")
Posted 23 July 2009 - 02:15 AM
ok='no'
while ok== 'no':
try:
q1=int(raw_input('\nWhat would you do 1, 2, or 3? '))
except ValueError:
#Oops, bad user input
#we must do something to go back to the top of the while loop
#without executing the rest of the code in the while loop
if q1 ==1:
...
|
|
Query failed: connection to localhost:3312 failed (errno=111, msg=Connection refused).
|
