Question: nums 1 = [ ] nums 2 = [ ] user _ input = input ( ' Enter first set of numbers: ' ) tokens

nums1=[]
nums2=[]
user_input = input('Enter first set of numbers: ')
tokens = user_input.split() # Split into separate strings
# Convert strings to integers
for pos, val in enumerate(tokens):
nums1.append(int(val))
print('{}: {}'.format(pos, val))
user_input = input('Enter second set of numbers:')
tokens = user_input.split()
# Convert strings to integers
print()
for pos, val in enumerate(tokens):
nums2.append(int(val))
print('{}: {}'.format(pos, val))
# Remove elements from nums1 if also in nums2
print()
for val in nums1:
if val in nums2:
print('Deleting {}'.format(val))
nums1.remove(val)
# Print new numbers
print('
Numbers only in first set:', end='')
for num in nums1:
print(num, end='')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!