Guest User

Untitled

a guest
Oct 23rd, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. House Party
  2.  
  3. Write a function that keeps track of guests that are going to a house party.
  4.  
  5. You will be given an array of strings. Each string will be one of the following:
  6.  
  7. "{name} is going!"
  8.  
  9. "{name} is not going!"
  10.  
  11. If you receive the first type of input, you have to add the person if he/she is not in the list (If he/she is in the list print: "{name} is already in the list!").
  12.  
  13. If you receive the second type of input, you have to remove the person if he/she is in the list (if not print: "{name} is not in the list!").
  14.  
  15. At the end print all the guests each on a separate line.
  16.  
  17. Examples
  18.  
  19. Input
  20.  
  21. Output
  22.  
  23. ['Allie is going!',
  24.  
  25. 'George is going!',
  26.  
  27. 'John is not going!',
  28.  
  29. 'George is not going!']
  30.  
  31. John is not in the list!
  32.  
  33. Allie
  34.  
  35. ['Tom is going!',
  36.  
  37. 'Annie is going!',
  38.  
  39. 'Tom is going!',
  40.  
  41. 'Garry is going!',
  42.  
  43. 'Jerry is going!']
  44.  
  45. Tom is already in the list!
  46.  
  47. Tom
  48.  
  49. Annie
  50.  
  51. Garry
  52.  
  53. Jerr
Add Comment
Please, Sign In to add comment