r/PythonLearning • • Nov 19 '25

Why isn’t this working

Post image

Hello im having a problem using my python code and sorry if its like a dumb question im really new at this

113 Upvotes

33 comments sorted by

47

u/TheBB Nov 19 '25

You've written a function but it isn't being called. Try doing suites(4) or whatever other number.

29

u/ianrob1201 Nov 19 '25

Your immediate question has already been answered, but you really need to name your variables better. When you come back to this in two days time are you going to remember what all those letters mean? Certainly for me looking at this, it's not very obvious what it's supposed to be doing.

The only exception to this rule is a "for" loop, where we often use i, x, n or similar. Every other variable should be well named so anyone can understand what it's doing. You might well be thinking "it's okay, I'll name them better once I figure it out" but you don't want to get in that habit as it only makes your life harder.

6

u/tiredITguy42 Nov 19 '25

I just add, that you always name everything in english. English is for programming, what Latin is for medicine. It is a very good habit to use english from the beginning.

12

u/Key-Procedure1262 Nov 19 '25

You didnt call the function

15

u/kcx01 Nov 20 '25

Oh because you took a picture instead of a screenshot.

5

u/TroPixens Nov 19 '25

Call function

4

u/No-Construction4699 Nov 19 '25

😭🤣 u have to use your funktion to use it

5

u/ChadwickVonG Nov 19 '25

Not seeing "please" and "thank you.

1

u/alk3mark Nov 20 '25

May I meet you? 🤣

1

u/Cherveny2 Nov 20 '25

please do the needful! /s

2

u/Individual-Age1163 Nov 19 '25

add suites(0) in the last line of the code then run it again , you are welcome🤗

2

u/SwisherSniffer Nov 20 '25

I made a comment but I was wrong mb 😂

1

u/NeedleworkerIll8590 Nov 19 '25

You didn't call the func

1

u/Darkstar_111 Nov 19 '25

It worked.

1

u/[deleted] Nov 20 '25

It is working! You defined a function. When you run the code, it will define the function. Done!

1

u/TalesGameStudio Nov 20 '25

You got to wait until K is smaller than N. (Which will never happen if the condition isn't fulfilled in the first place, since K is only increasing)

So the only way not being caught in an endless while loop in N>=0. Then it will throw an error, because W is not defined.

1

u/Dani02_11 Nov 20 '25

You have to call the function. At the end withoud indentation put suites(10)

1

u/DoctorSmith2000 Nov 20 '25

At this point just stop coding and go to study the theory again. A function has to called to be executed

1

u/Coder3346 Nov 21 '25

Usg gpt or something

1

u/TheCarter01 Nov 21 '25

You ain't calling the function

1

u/Impossible-Doubt7476 Nov 21 '25

an try to use vs code or google antigravity

1

u/Usual-Addendum2054 Nov 22 '25

You have not called the function , that's why it is not executing anything

1

u/No_Requirement5979 Jan 27 '26

call this function outside this function definition, in global space with some number as argument

0

u/[deleted] Nov 19 '25

[deleted]

1

u/NeedleworkerIll8590 Nov 19 '25

Return still won't do nothing if the function isn't called

4

u/[deleted] Nov 19 '25

[removed] — view removed comment

2

u/laptop_battery_low Nov 20 '25

def functionName(variables) is incorrect terminology.

its functionName(parameters). When you actually call the function, the parameters become arguments.

0

u/TunesForToons Nov 19 '25

Just print(c) inside the function.

-4

u/[deleted] Nov 20 '25

[removed] — view removed comment

1

u/PythonLearning-ModTeam Feb 18 '26

Keep it respectfull