Jul-14-2019, 10:05 PM
The problem seems like it should be rather easy, but I'm all over the map in trying to solve it. Here it is:
Write a function, sublist, that takes in a list of numbers as the parameter.
In the function, use a while loop to return a sublist of the input list.
The sublist should contain the same values of the original list up until it reaches the number 5 (it should not contain the number 5).
What I have:
Anyway, sorry for the mess, but I truly need help with this.
Write a function, sublist, that takes in a list of numbers as the parameter.
In the function, use a while loop to return a sublist of the input list.
The sublist should contain the same values of the original list up until it reaches the number 5 (it should not contain the number 5).
What I have:
inputlist = [1, 2, 3, 4, 5] def sublist (inputlist): sublist2 [] count = 0 while count < 4: sublist2.append(count) count = count + 1I'm unclear about a number of things.
- When they want the sublist to take in a list of numbers as the parameter, are they referring to having something like I put down, that is a sublist that imports its parameters from a separate list, in this case inputlist.
- What call should I make for the function, if the parameters are already set?
- Do I need a second sublist to which I can append the incremented list of integers? One to take the list of parameters and another to return a sublist of the input list.
Anyway, sorry for the mess, but I truly need help with this.