What did I do wrong

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/en/courses/python-beginner-en-zFPOx/0/5?curriculum_id=4f89dab3d788890003000096
<In what way does your code behave incorrectly? Include ALL error messages.>
Oops, try again. It looks like your printed time is not in the proper format: hh:mm:ss
<What do you expect to happen instead?>
It to let me pass

```python

Replace this line with your code.
from datetime import datetime
now = datetime.now()

print ‘%s:/%s:/%s’ % (now.hour, now.minute, now.second)

<do not remove the three backticks above>

You seem to have needless slashes. Please remove. See below.

print '%s:%s:%s' % (now.hour, now.minute, now.second)

Hope this helps! :slight_smile:

1 Like

Thanks a lot : srry about replying late::slight_smile:

1 Like

It’s fine.

Have fun coding! :slight_smile:

What is wrong? I am in the Grand Finale.
print’%s/%s/%s %s:%s:%s’(now.month, now.day, now.year, now.hour, now.minute, now.second)

How you do that is:

print '%s:%s:%s' % (now.hour, now.minute, now.second)

I assume this is your issue and you got the others right.

I have a question: https://www.codecademy.com/en/courses/python-beginner-c7VZg/4/3?curriculum_id=4f89dab3d788890003000096#

Requirement:
First, def a function called distance_from_zero, with one argument (choose any argument name you like).
If the type of the argument is either int or float, the function should return the absolute value of the function input.
Otherwise, the function should return “Nope”

My code is as follow, could you help me figure out the problem, thank u!

def distance_from_zero(thing):
absolute=abs(thing)
if type(thing) = int or float
return absolute

else:
    return "Nope"

Instead of “thing” as an argument to the “distance_from_zero” function, use “num”. With this, you should use the “num” argument until the absolute return, ie “return abs (num)”.

Then create the “if” statement, type with the argument (“type (num)”), which is equal to, “int or float” ("type (num) == int or type (num) == float ").

I hope you understood.

thank you, I did as follow, but it didn’t work.

def distance_from_zero(num):
absolute=abs(num)
if type(num) == int or type(num) == float
return abs(num)

else:
    return "Nope"

the error warning:
Oops, try again. It looks like you have a NameError. Maybe you forgot to create a function called distance_from_zero? Check the error message for more info! - global name ‘distance_from_zero’ is not defined

1 Like

You changed the code order haha :smile:
It’s all right just need to exchange one line of code for another!
Assim:

def distance_from_zero(num):
    
    if type(num) == int or type(num) == float:
        return abs(num)   
    else:
        return "Nope"


print distance_from_zero(10)
print distance_from_zero(10.0)
print distance_from_zero(10.0)

print ‘%s/%s/%s %s:%s:%s’ % (now.month, now.day, now.year, now.hour, now.minute, now.second)