Skip to content

Latest commit

 

History

History
38 lines (33 loc) · 1.42 KB

ctd2.md

File metadata and controls

38 lines (33 loc) · 1.42 KB

Challenges To Do

(ctd for short)

Challenges


1 - I hate the user

Make a bag that the user can use to store numbers in and remove numbers from whenever he wants, the user can choose what number to remove from the bag or to add a number to the bag and display the result of contents in the bag after each interaction with the user. the bag must contain more than 5 numbers at all times and does not allow user to remove from it if it will have less than 5. you can start the list with random numbers in code at the start.

  • make list in code called bag which contains at least 5 numbers at all times
  • check for user input at the start as always
  • print out the contents of the list bag in the beginning and after each update
  • give the user the ability to enter numbers into the bag after saying enter
  • give the user the ability to remove numbers from the bag after saying remove
  • don't let the bag have less than 5 numbers at any time

example: this is an example scenario for user input against the desired program behavior

program output : [6, 22, 10, 999, 76, 43]
user : remove
user : 10
program output : [6, 22, 999, 76, 43]
user : remove
program output : cannot remove, bag is at minimum capacity
program output : [6, 22, 999, 76, 43]
user : enter
user : 30
program output : [6, 22, 999, 76, 43, 30]
user : enter
user : 420
program output : [6, 22, 999, 76, 43, 30, 420]

Roben's Software & AI team