pylint indentation fix
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 9s
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 9s
This commit is contained in:
parent
3976c7d8bc
commit
14c41cfd45
1 changed files with 7 additions and 10 deletions
|
@ -1,19 +1,16 @@
|
||||||
from time import (
|
from time import \
|
||||||
sleep, #the sleep function adds a delay, allowing time to tick down by a second rather than instantly
|
|
||||||
)
|
|
||||||
|
|
||||||
sleep # the sleep function adds a delay, allowing time to tick down by a second rather than instantly
|
sleep # the sleep function adds a delay, allowing time to tick down by a second rather than instantly
|
||||||
|
|
||||||
|
|
||||||
def countdown(n: int) -> None:
|
def countdown(n: int) -> None:
|
||||||
if n <= 0: #If a number is less than or equal to 0,
|
if n <= 0: #If a number is less than or equal to 0,
|
||||||
print('Blastoff!') #Blastoff! is printed, else
|
print('Blastoff!') #Blastoff! is printed, else
|
||||||
else:
|
else:
|
||||||
print(n) #we print the current number inputted,
|
print(n) #we print the current number inputted,
|
||||||
sleep(1) #The code is delayed by a second to replicate an actual countdown
|
sleep(1) #The code is delayed by a second to replicate an actual countdown
|
||||||
countdown(n-1) #The code deducts 1 from our inputted number, until it reaches 0.
|
countdown(n-1) #The code deducts 1 from our inputted number, until it reaches 0.
|
||||||
|
|
||||||
def countup(n: int) -> None:
|
def countup(n: int) -> None:
|
||||||
if n >= 0: #we're definining the countup function, if a number is 0 or greater
|
if n >= 0: #we're definining the countup function, if a number is 0 or greater
|
||||||
print('Blastoff!') #if the above condition is met, Blastoff! is printed, else
|
print('Blastoff!') #if the above condition is met, Blastoff! is printed, else
|
||||||
else:
|
else:
|
||||||
|
@ -22,11 +19,11 @@ def countup(n: int) -> None:
|
||||||
countup(n+1) #We add 1 to our number, since with a countup, we'll be dealing with negatives going towards 0
|
countup(n+1) #We add 1 to our number, since with a countup, we'll be dealing with negatives going towards 0
|
||||||
|
|
||||||
def count(n: int) -> None: #this part of the code checks to see if a number is positive or negative
|
def count(n: int) -> None: #this part of the code checks to see if a number is positive or negative
|
||||||
if int(n) >= 0: #We're checking for if a positive number is inputted, or negative
|
if int(n) >= 0: #We're checking for if a positive number is inputted, or negative
|
||||||
countdown(n) #If positive, we'll utilize the Countdown function
|
countdown(n) #If positive, we'll utilize the Countdown function
|
||||||
else:
|
else:
|
||||||
countup(n) #If negative, we'll utilize the countup function
|
countup(n) #If negative, we'll utilize the countup function
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
num = input("Enter a number: ")
|
num = input("Enter a number: ")
|
||||||
count(int(num))
|
count(int(num))
|
||||||
|
|
Loading…
Add table
Reference in a new issue