79561021

Date: 2025-04-08 01:52:52
Score: 0.5
Natty:
Report link

When you want to perform an action a certain number of times without caring about the loop variable, the convention is to use an underscore (_) instead of a named variable like i. This signals to readers of your code: "I'm not going to use this variable."

So your questionable function can be rewritten in a more Pythonic way like this:

def more_pythonic():
    for _ in range(3):
        print('Is this OK?')
Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): When you
  • Low reputation (0.5):
Posted by: João Amgarten