Skip to content

Instantly share code, notes, and snippets.

@criskell
Last active October 25, 2024 19:34
Show Gist options
  • Select an option

  • Save criskell/fe0653ef8ee8f2ee8c59fead75c04320 to your computer and use it in GitHub Desktop.

Select an option

Save criskell/fe0653ef8ee8f2ee8c59fead75c04320 to your computer and use it in GitHub Desktop.
Exercício 73 - Curso em Vídeo
import time
tabela = ('Botafogo', 'Palmeiras', 'Fortaleza', 'Flamengo', 'São Paulo', 'Internacional', 'Bahia', 'Cruzeiro',
'Atlético-MG', 'Vasco', 'Fluminense', 'Criciúma', 'Grêmio', 'Bragantino', 'Juventude', 'Vitória',
'Corinthians', 'Athletico-PR', 'Cuiabá', 'Atlético-GO')
print('Welcome to the Brazilian championship table')
print(''' Options menu
To check the top 5 in the table, type { 1 }
To check the last 4 placed press { 2 }
To access the table in alphabetical order type { 3 }
To see what position Chapecoense's team is in, type { 4 }
To close type { 5 }''')
while True: # Infinite loop
n = int(input('Enter the desired option: '))
if n == 1:
print(f'The top 5 teams are: {tabela[0:5]}')
if n == 2:
print(f'The last teams are: {tabela[16:21]}')
if n == 3:
print(f'{sorted(tabela)}')
if n == 4:
print('Series B, at 15º is Chapecoense')
if n == 5:
print('Closing Program...')
time.sleep(1.5)
break # End the loop
print('Program Closed!')
@criskell
Copy link
Author

import time

tabela = ('Botafogo', 'Palmeiras', 'Fortaleza', 'Flamengo', 'São Paulo', 'Internacional', 'Bahia', 'Cruzeiro', 
          'Atlético-MG', 'Vasco', 'Fluminense', 'Criciúma', 'Grêmio', 'Bragantino', 'Juventude', 'Vitória', 
          'Corinthians', 'Athletico-PR', 'Cuiabá', 'Atlético-GO')

print('Welcome to the Brazilian championship table')
print(''' Options menu
To check the top 5 in the table, type { 1 }
To check the last 4 placed press { 2 }
To access the table in alphabetical order type { 3 }
To see what position Chapecoense's team is in, type { 4 }
To close type { 5 }''')

# This variable indicate if program is running.
running = True

while running:
    n = int(input('Enter the desired option: '))

    if n == 1:
        print(f'The top 5 teams are: {tabela[0:5]}')
    
    if n == 2:
        print(f'The last teams are: {tabela[16:21]}')
    
    if n == 3:
        print(f'{sorted(tabela)}')
    
    if n == 4:
        print('Series B, at 15º is Chapecoense')
        
    if n == 5:
        print('Closing Program...')
        time.sleep(1.5)
        
        running = False # End the loop

print('Program Closed!')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment