I have the following script:
#! /usr/bin/python3
name1 = input('Enter the name of first person ')
name2 = input('Enter the name of second person ')
age1 = int(input("Enter the first age "))
age2 = int(input('Enter the second age '))
print('%s' %name1, 'is %d' %age1, 'years and %s' %name2, 'is %d' %age2, 'years')
agex = age1
age1 = age2
age2 = agex
print('Now we swap ages: %s' %name1, 'is %d' %age1, 'years and %s' %name2, 'is %d' %age2, 'years')
What I'd want is to ask for ages including the name entering in the name questions, I mean, something like:
age1 = int(input("Enter the age of", name1))
But that does not work...
So if you answer as first personame John, so you should get:
Enter the age of John:
How can I do that?