//This is my code, It looks kind of complicated. I didn't think about using "X and Y" // My answer looks like ('Doe', '3/14/85') // I want to know why it put parentheses and commas. I just want it to print out the last name and date of birth question = "Enter your date of birth:" print (question) answer = raw_input() question = "Enter your last name:" print (question) response = raw_input() print (response, answer)
//You do java too? :D # You use the "#" symbol in python to comment out lines Ok, I am still pretty new to python, but here's the way I would change/rewrite your code: #this line has the exact same meaning of the first 3 lines of your code date_of_birth = raw_input("Enter your date of birth: ") #this has the same purpose as your next 3 lines, all combined into one last_name = raw_input("Enter your last name: ") #the way you had your print line worked fine, but this also will work print date_of_birth, last_name
Thank you so much!!! I do use a little java, i had to use it in my senior design project for college. I was just commenting out my questions so people would know lol but i did not know # was used for commenting in python. I am really new to this , I want to expand my knowledge in coding languages, that's why I am trying to learn python . Thanks again, I really appreciate it. That was so much easier to do the way you showed me.
glad i could help :D
If you're running your code in Python v 2.x, I think that your print statement is making a tuple out of response and answer and then printing the tuple. It would be fun to try without the parentheses.
Join our real-time social learning platform and learn together with your friends!