#๐ how do i take in a list of integers instead of a string of integers?
35 messages ยท Page 1 of 1 (latest)
@undone ingot
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
it would definitely be odd to expect the input() to be written as a python list
when they say "takes in a list of integers", they likely are referring to a function parameter
what about the parameters here should i change to make it accurate?
I don't really have enough information about how exactly they expect you to structure your code
I would create a function that accepts a list of ints as a parameter
how you arrive at that list really isn't important
You can test code without the need for input()
!e
def wave(nums):
for num in nums:
print('*' * num)
wave_nums = [1, 2, 3, 2, 1]
wave(wave_nums)
@civic terrace :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | *
002 | **
003 | ***
004 | **
005 | *
this is how they test it
Then I was correct in what they expect of you
but this part: wave_nums = [1, 2, 3, 2, 1] is set to certain values
that was just so I could show you a test in action
a function simply says "give me some data and I'll do something with it"
it doesn't care where that data comes from
so you're meant to provide a function that can handle what they're asking of you
where it gets its numbers from is of no importance
you only need to write the function
it will handle the testing
(but it's still good to test your own function before submitting)
you shouldn't even call the function at the bottom
and you shouldn't need to do int(num) because they've already informed you that the provided list will contain ints
i dont get how this test will work if i dont call it
It will call it for you to test it
you don't need to call your own function to prove it works
the tests are responsible for that
oh ok
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.