0
Please I am stuck at Time's up
18 Answers
+ 6
show your code.
mention course name.
+ 6
Prosper Jacob
your post seems to be incomplete. it should include:
> the programming language (to be placed in tags)
> if your post is related to a sololearn tutorial, we need to know the name of it, also the module and lesson /exercise name.
> a clear task description with input / output sample
> a link that points to your code try
> a description what exactly your issue is, (if possible including an error message)
info:
time's up! is an exercise in the *introduction to python* tutorial, control flow (module 4).
+ 4
The objective is to take a number as input and do a countdown. The given code is an infinite loop because the variable 'number' never changes. You need that variable to decrease within the loop until the condition of the while loop is met. Here is a working example:
https://code.sololearn.com/cazFTTMD7ESw/?ref=app
+ 4
Prosper Jacob ,
if there is still an issue, please link your current code here.
+ 4
Prosper Jacob ,
there is an issue with indentation in the last line of your code.
> decrementing of the value stored in variable `number` has to be done inside the while loop. correct this.
> also the indentation you used in your code (1 space only), makes it difficult to read the code.
the recommendation is to use 4 spaces per indentation level.
+ 3
Prosper Jacob You should also post your attempt so that we can help you. Try to solve it and if you are still stuck use the share button in Code Playground to copy and paste the link here.
+ 2
pls show your code so that you can get better solutions
+ 2
Prosper Jacob that is the code from the practice exercise. It results in an infinite loop.
I explained the answer and posted a link to an example in my previous comment so take a look at that 👍
+ 2
You must be typing something incorrectly because I just copy and pasted this exact code into the 'Time's Up' challenge in the Intro to Python course and it passed all 3 tests...
Make sure your indenting everything correctly and if you still have any errors, let us know what the error says. The error should give you hints as to what is wrong.
0
<Course title:Introduction to python>
<Lesson:Time's up>
0
#Here’s part of the code:
# take the number as input
number = int(input())
#use a while loop for the countdown
while number >= 0:
print(number)
#Now add the missing part so it’s not an infinte loop
0
While loop needs to be changes to > -1
And your counter is set to counter = counter - 1
0
#or even this:
counter-=1
0
I wrote (while number >=1
Print(number)
0
It has some little error
0
It says the code is an infinite loop and the file too large
0
take the number as input
number = int(input())
#use a while loop for the countdown
while number >= 0:
print (number)
number = number - 1
0
Please can you teach me python