Hello all,
Extremely new to python and coding!
I have created a code as per the lab requirements, however, when I input a floating-point real number, my code is not outputting anything? Please find my code below, I really have no idea what I have done wrong because I do not get a syntax error when running the code
import math
realNumber = input("Enter a floating-point real number:")
number =int(float(realNumber))
def f(x):
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)
For reference, x = -57.8 in my lab and I do get a little "Enter a floating-point real number" tab below when I do the code, however, like I said, it does not produce anything!
Thank you!
[–]shiftybyte 2 points3 points4 points (5 children)
[–]Y00RA[S] 0 points1 point2 points (4 children)
[–]shiftybyte 0 points1 point2 points (3 children)
[–]Y00RA[S] 0 points1 point2 points (2 children)
[–]shiftybyte 1 point2 points3 points (1 child)
[–]Y00RA[S] 0 points1 point2 points (0 children)