#Write a program which first asks the user for their full name.
#It should then ask appropriate questions concerning their gender and
#marital status in order to determine their title (Miss, Mrs or Mr).
#Finally, it should greet the user formally using their title and
#surname e.g. Hello Mr AKHTAR
i have made this code as well, but want to know wht can be improved or chaged, to make it more effecient. there is an attached file as to see clearer
#It should then ask appropriate questions concerning their gender and
#marital status in order to determine their title (Miss, Mrs or Mr).
#Finally, it should greet the user formally using their title and
#surname e.g. Hello Mr AKHTAR
i have made this code as well, but want to know wht can be improved or chaged, to make it more effecient. there is an attached file as to see clearer
Code:
forename = raw_input ("Please enter your forename :") surname = raw_input ("Please enter your surname :") gender = raw_input ("Please enter in your gender information (male or female): ") maritalstatus = raw_input ("Please enter in your marital status information (single or married): ") if gender == "m" or gender == "M" or gender == "male" or gender == "Male": if maritalstatus == "single": #user is male print "Hello Mr" + surname else: print "Hello Mr" + surname elif gender == "f" or gender == "F" or gender == "female" or gender == "Female": if maritalstatus == "single": #user is female print "Hello Miss" + surname else: print "Hello Mrs" + surname
Comment