Hi fellas! well, im triying to restart not the entire function here below, but just from one part as an option if the user dont want the entire count.
I’VE READING ARTICLES
, I thank you for the support in advance 
def justNumbersAndLoops(a):
for a in range(10):
print(a)
if a == 3:
op1 = input(f'the reached number is {3}, do you want to proceed?: ')
if op1 == 'y':
continue
print(a)
elif op1 == 'n':
break
#here is where my "restart" action should be!
print(justNumbersAndLoops(numbers))
You call the function with an argument numbers
. What is the value of numbers
? You do not appear to actually use the value passed to the function, as you end up assigning a
a different set of values via the for
loop.
If the game does start again, you will always be checking if a
is 3, so what would be the point?
There is not much point in using print
here as your function does not return a value to be printed. You can just call the function without the print instead.
Anyway, one way to start the function again, is to just call the function again from within the function (as part of the elif
code block.
Hi! well, the target is to give the user a chance of restart of the wole account.
you mean do something like this?:
pd: sorry, my fault, i forgot to insert the “numbers” value on the top of it…
numbers = 0
def justNumbersAndLoops(a):
for a in range(10):
print(a)
if a == 3:
op1 = input(f'the reached number is {3}, do you want to proceed?: ')
if op1 == 'y':
continue
print(a)
elif op1 == 'n':
break
justNumbersAndLoops(a)
print(justNumbersAndLoops(numbers))
The break
does not allow the function call to be made in the elif
code block. Anything after the break
is never executed.