In: Computer Science
write a python program, please.
Create a program that uses the Gettysburg Address as input and outputs a list
of tuples for every two words. For example: [('Four', 'score'),('and',
'seven'), ...].
gettysburg_address=input("Enter gettysburg address:")
l=gettysburg_address.split(" ")#split input by using space
res=[]
for i in range(0,len(l),2):
res.append((l[i],l[i+1]))#append the tuple to list res
print(res)#print list
Screenshots:
The screenshots are attached below for reference.
Please follow them for output.
Please upvote my answer. Thank you.