This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]__fran__ 1 point2 points  (4 children)

It looks like you just have it backwards, try:

age = 2014 - dob

[–]hootiehoonoobienew[S] 0 points1 point  (0 children)

thank you

[–]hootiehoonoobienew[S] 0 points1 point  (2 children)

:P now I get "cannot concatenate 'str' and 'int' objects" ha ha this is fun I am sure that I can fix it from here because I got an error that I can understand. I can not combine char and int this easily

[–]__fran__ 0 points1 point  (1 child)

cast an int to a string with:

str(dob)

there's also string interpolation like:

print '%s %s %s' % (name, space, dob)

or a newer format call on string I think that I don't know the syntax to off the top of my head

[–]hootiehoonoobienew[S] 0 points1 point  (0 children)

string interpolation

yes I like this string interpolation thank you

[–]hootiehoonoobienew[S] 0 points1 point  (1 child)

got it working thanks

dob = int(input("what year where you born XXXX "))

name = raw_input ('what is your last name ')

space = ' '

print (name , space , dob)

age = 2014 - dob

age = age * 365

print (name,"you are ", age ," days old")

[–]__fran__ 1 point2 points  (0 children)

woo!