Question

write in python Create a program that will ask the user for a list of integers,...

write in python

Create a program that will ask the user for a list of integers, all on one line separated by a slash. construct a list named "adj_numbers" which contains the users input numbers after subtracting 2 from each number. then print the resulting list. the input statement and print statement are given to you in the starting code. a sample run of the program is as follows:

Enter a list of integers, separated by slashes:

7/3/6/8

resulting list: [5,1,4,6]

integer_string = input("Enter a list of integers, separated by slashes:\n")

0 0
Add a comment Improve this question Transcribed image text
Answer #1
integer_string = input("Enter a list of integers, separated by slashes:\n")
lst = []
for word in integer_string.split('/'):
    lst.append(int(word) - 2)
print("resulting list:", lst)

Enter a list of integers, separated by slashes: 7/3/6/8 resulting list: [5, 1, 4, 6]

Add a comment
Know the answer?
Add Answer to:
write in python Create a program that will ask the user for a list of integers,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT