Posts by aquaben
Trying to get soemone to input a Password (hello) as an input and then getting a loop to a second part of the program where he/she inputs his/her name and then gets a response accordingly.
Not sure why this is not working but maybe someone else does.
let me know how you fixed the issue so i can learn from my mistakes.
print "Program 3 Loops and If Conditions"
#prints the title
print ("Author: Benoit Labelle")
#prints the author's name
print ("ID: 3065521")
#prints the authors id number
loop= 1
choice= 0
def enter_password():
pwrd=raw_input("hello")
wpass=raw_input("Password: ")
return Password
def enter_name():
cher=input("Can I get your authograph")
madonna= input("Can I get your authograph")
ben=input("What a great name!! ")
benoit=input("What a great name!! ")
choice = int(raw_input("Password ").strip())
return
while loop==1:
print "Option 1: Enter your password"
print "Option 2: Exit"
choice = int(raw_input("Enter your option: ").strip())
if choice ==1:
pwrd= input("Password")
if input is hello:
print "Welcome to the second part of the program"
loop==2
elif input is not hello:
print "Password"
if choice== 2:
loop=0
print " Thank you come again"
while loop==2:
choice = int(raw_input("What is your name: ").strip())
if name== Benoit:
print "What a great name!!!"
elif name == Madonna:
print "Can I have your authograph?"
elif name == Cher:
print "May I have your authograph?"
elif name != Benoit or Cher or Madona:
print "what a nice name"
aquaben
Newbie Poster
2 posts since Apr 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0
Hey
As my title sais having issues getting characters (like names and such ) in my code. I can only get numbers
Any help would be appreaciated
print ("Program 2: Using Inputs")
#prints the title
print ("Author: Benoit Labelle")
#prints the author's name
print ("ID: 3065521")
#prints the authors id number
loop=1
choice=0
while loop==1:
print "This program will add your first name to your last name, and then multiply your two favorite numbers in a select order"
print "Option 1: First name, Last Name, Numbers"
print "Option 2: Numbers, First Name Last Name"
print "Option 3: Exit"
choice = int(raw_input("Choose your option: ").strip())
if choice ==1:
fn=raw_input("please select your first name")
ln=raw_input("Please select your Last Name")
fnbr=input("please select your favorite number")
sfnbr=input("please select your second favorite number")
print fn, ln
print fnbr * sfnbr
elif choice==2:
fnbr=input("please select your favorite number")
sfnbr=input("please select your second favorite number")
fn=raw_input("please select your first name")
ln=raw_input("Please select your Last Name")
print fnbr * sfnbr
print fn, ln
elif choice ==
3: loop = 0
print "thank you"
# fn = first name
#ln = last name
# fnbr = favorite number
# sfnbr = secodn favorite number
Any help would be greatly appreaciated, with explanations why so i dont make this stupid mistake again
Thanks
Ben
"live life at it's fullest"
aquaben
Newbie Poster
2 posts since Apr 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0
© 2013 DaniWeb® LLC
Page generated in 0.0704 seconds
using 2.48MB