How restart loop after enum's execution?

Question:

Have a problem with my loop. How loop can be restarted after picking one of the numbers (as input) in "pick" IntEnum?
Any ideas?

from enum import IntEnum

Menu = IntEnum('pick', 'SAEMP25N SAEMP27N SAGDP1 SAGDP9N 
SAGDP6N SAINC5N SAINC6N SAPCE2')


pick = int(input("""
Pick number:
1. SAEMP25N
2. SAEMP27N
3. SAGDP1
4. SAGDP9N 
5. SAGDP6N
6. SAINC5N 
7. SAINC6N
8. SAPCE2
"""
                 ))

while pick < 8:
    
    if pick == Menu.SAEMP25N:
        print('nice')
        continue
    
    if pick == Menu.SAEMP27N:
        print('nice')
        continue
              
    else:
        print('..')
Asked By: Oskar

||

Answers:

Right now you’re asking for input once, you need to do it repeatedly inside the loop:

while True:
    
    pick = int(input(""" .... """))
    
    if pick == Menu.SAEMP25N:
        print('nice')
    if pick == Menu.SAEMP27N:
        print('nice')
    else:
        print('..')
    
    if pick == 8: 
        break
Answered By: ps256
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.