How can I increment the input statement in python? -


my question how show "student 1 name," "student 2 name" etc goes through loop 12 names?

students = 12 x in range(students):     name = str(input('student name: '))     grade = int(input('enter average grade: ')) 

to add andrew li's comment, can append string directly in python using "+" operator:

in case don't want use format method, can try this:

name = input("student " + str(x + 1) + " name: ") 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -