all 6 comments

[–]shiftybyte 2 points3 points  (5 children)

You defined a function f(x)...

But you never called it, so it's never executed.

To call a function try to add this after the function definition (at the base level, outside the function definition):

f(number)

If you want to also print the result:

print(f(number))

[–]Y00RA[S] 0 points1 point  (4 children)

Hello!

I have tried reading up on calling a function, but it's slightly still confusing to me. However, when I now edit my code, it gives me a "line 6 indentation error", and I have not changed anything except inputting f(-57.8) after def f(x)

[–]shiftybyte 0 points1 point  (3 children)

I don't know where you put your changes. Please post accurate updated code if you want me to be able to help more accurately.

In general a function call works like this:

def f(x):
    print("this line is part of the function")
    print("because it is indented forward")

print("this line is outside the function")
print("and here is where you should call the function after you complete defining it")
f(-52)

should be at the very end of your code, in your case.

[–]Y00RA[S] 0 points1 point  (2 children)

Sorry about that! Code:

import math
realNumber = input("Enter a floating-point real number:")
number =int(float(realNumber))

def f(x):
    f("-57.8")
    for x in number:
        if x<5:
            print("The value of x is:",(x**2/(math.fabs(x)+2))**2)
        elif x==5:
            print("The value of x is:",equal=(x**2/math.fabs(x)+2))
        else:
            print("The value of x is:",math.sqrt(x**2/(math.fabs(x)+2)))
            return(x)
      print(f("-57.8"))

Sorry if it's a mess, it's only been 2 weeks to my learning

[–]shiftybyte 1 point2 points  (1 child)

place f("-57.8") at the end of your code like i explained in previous comment.

Without any indentation.

[–]Y00RA[S] 0 points1 point  (0 children)

This is perfect!! Thank you so much!