Python: how to automaticlly restart my programme

微信图片_20171213192803

hi everybody!

I am the beginner. I made a small programme with Python. It runs very well. But I want to do more for this one.
My question is after While bingo==True, how it can restart automaticlly.

Thanks!

You can put everything inside another while loop, ask user for input, e.g Press 'n' for new game or 'q' to exit then compare and break if necessary.

Maybe like this (don’t know python):

while True:
    print('hello')
    ....

    while bingo == False:
        ....

    query = input('Press 'n' for new game or 'q' to exit: ')

    if query == 'q':
        break
    ...

Thanks for your answer . I will try it later. I think your thought is right. But Python may have different rules.
I may create it when I learn more about Python.

1 Like