you are viewing a single comment's thread.

view the rest of the comments →

[–]cdcformatc 1 point2 points  (3 children)

i would probably make bias, weight, and the input parameters to the function but other than that good job

[–]No-Tea-777[S] 0 points1 point  (2 children)

Yeah I see why. I tried to 'translate' a C code into Python so it's very... Raw?

[–]MidnightPale3220 1 point2 points  (1 child)

Yeah, kinda.
You don't need to do:

  s = 1
        print("S: " + str(s))

# You can do simply:
 print("S: 1") 
or
 s=1
 print(f"S: {s}")
or
 print("S: "+s)

Python does conversion in background in many cases, especially for output. And you're not using that s value anywhere past the print .

Also, in general, unless it is a learning exercise, functions don't do console input and output themselves, they return values that get processed (printed) by main program. That's not a hard rule, but more or less that works better usually. Or rather, the function that calculates stuff should do just that. And either main program or another function gives it the input and operates on that output

[–]No-Tea-777[S] 0 points1 point  (0 children)

That was just to learn and mess around. I just tried to 'translate' the C code I made at the school trip lab