#Simple input and output, simple math and string manipulation #Simple input #Version 2 in comments #hometown = str(raw_input('Where were you born (city): ')) #yearofbirth = int(raw_input('What year? ')) hometown = input('Where were you born (city)? ') yearofbirth = int(input('What year? ')) #Simple math high_age = 2019 - yearofbirth low_age = high_age - 1 #Simple ways to output print ('Example 1') print ('You were born in ' + hometown + ' in ' + str(yearofbirth) +'.') print ('You are ' + str(low_age) + ' or ' + str(high_age) + ' years old.') print ('Example 2') print ('You were born in %s in %g.' % (hometown, yearofbirth)) print ('You are %g or %g years old.' % (low_age, high_age)) #String construction print ('Example 3') outputstring = 'You were born in ' + hometown + ' in ' + str(yearofbirth) + '.' print (outputstring) outputstring = 'You are ' + str(low_age) + ' or ' + str(high_age) + ' years old.' print (outputstring) #Another string to illustrate \n in the middle of a string to force a new line of output print ('Example 4') outputstring = 'You were born in ' + hometown + ' in ' + str(yearofbirth) +'.\n' + 'You are ' + str(low_age) + ' or ' + str(high_age) + ' years old.' print (outputstring)