User = ("Peter", James, "John)
Age = (18 , 20 , 22)
str = "{}, is a laborious student and he is {}."
Output :
- Peter, is a laborious student and he is 18.
- James, is a laborious student and he is 20.
- John, is a laborious student and he is 22.
User = ("Peter", James, "John)
Age = (18 , 20 , 22)
str = "{}, is a laborious student and he is {}."
Output :
Use zip to iterate two tuples in parallel.
users = ("Peter", "James", "John")
ages = (18 , 20 , 22)
for (a, b) in zip(users, ages):
str = "{}, is a laborious student and he is {}.".format(a, b)
print(str)