#๐ Task 1 help
37 messages ยท Page 1 of 1 (latest)
@inland geyser
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.
Please react with โ
to upload your file(s) to our paste bin, which is more accessible for some users.
and what u need help with ?
I plugged in 20 and 5 but it doesnt give the same result the professor has shown us in the assignment's directions
Here are the instructions for task 1 btw
The examples don't look right when I pasted it on disc, heres a screenshot of it
so first, walk through your code using the exapmle that doesnt work, 20 and 5
whats the first if statement doing?
So first I try to intialize my variables for the while loop
ignore the print statement
yeah but the first if statement you run into is this
if add_stories%2 == 0:
return 0
thats a modulus its checking if the remainder of a division by 2 is 0
Oh
hm...
Well how do I fix that?
Should an if statement saying is pausesTaken == 0, return 0?
Alright so now we gotta fix the while loop
yeah so what does the while loop do in each cycle of the loop
For some reason it returns nothing
But im trying to figure out where I went wrong.
yeah so count+=1 is good that makes sense, but then add_stories//2, you're just dividing add_stories by 2 but youre not storing the result anywhere
and lastly keep in mind that when you return count that stops the loop early
if you change those 2 lines it should be fixed
alright so I'll have to remove the return command then?
you have to move it so its not stopping the loop the first time the loop is run and only returning once count is the correct answer
Im gonna take a break and eat breakfast
alright good luck
This help channel has been closed. 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.