João Pedro Gomes
João Pedro Gomes

Reputation: 49

How can i show index on the input of user?

I can show for user the number of task, example: input('Start task 1:' )

n = input('Digite o numero de trabalhos: ')
i = 0

job = []

while(i != n):
    start_job1 = int(input('Inicio da tarefa: ' ))
    final_job1 = int(input('Final da tarefa: '))
    lucro_job1 = int(input('Valor da tarefa: '))

    job.append(Job(start_job1, final_job1, lucro_job1))
    i = i+1

print("Melhor lucro sera: "),
print schedule(job)

Upvotes: 0

Views: 34

Answers (1)

blhsing
blhsing

Reputation: 106618

You can format your string with the str.format method:

start_job1 = int(input('Inicio da tarefa {}: '.format(i + 1)))

or with the string formatting operator:

start_job1 = int(input('Inicio da tarefa %d: ' % (i + 1)))

Upvotes: 1

Related Questions