Answer to Question #327342 in Python for Seshu

Question #327342

A group of people are playing a game.They are standing and each carring a card with a number on it.These numbers in the list A. A random number S iis selected.


Find out the new list of numbers after

  • S people were removed from the left.
  • S people were removed from the right.


Sample Input1

1,2,3

1

Sample Output1

2 3

1 2



1
Expert's answer
2022-04-13T09:01:35-0400
string = input("Enter card numbers separated with ',':\n")
list = string.split(",")
S = input("Enter the number of removed people: ")
S = int(S)
left = " ".join(list[S:])
right = " ".join(list[:len(list) - S])
print("Removed from the left: ", left)
print("Removed from the right: ", right)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS