python - How to have something print only once? -
i'm unsure why it's taking answer, , instead of continuing onto next question, repeats once more before doing so?
also, after second question (there's two), shows them both in parentheses still? please me, thank you. ^_^
here's code way:
print (raw_input('what date of birth?')) y = raw_input('what date of birth?') print ('your date of birth ' + y) print (raw_input('what last name? ')) x = raw_input('what last name?') print ('your last name ' + x) print ('your date of birth ' + y, 'your last name ' +x)
i'm using python 2.5.4.
raw_input()
itself prints prompt. also printing return value of raw_input()
call. repeat raw_input()
function call again.
remove print(raw_input(..))
lines; redundant:
y = raw_input('what date of birth?') print 'your date of birth ' + y x = raw_input('what last name?') print 'your last name ' + x
next, in python 2, print
not function, statement. treating 1 however, python sees (.., ...)
part (with comma) producing tuple. remove parentheses:
print 'your date of birth ' + y, 'your last name ' + x
now whole line part of print
statement separate arguments it, printing 2 string results space in between.
Comments
Post a Comment