How can I print player’s names with their scores?
** (Player) Has (Score) Points
Here's My Code
#python 3.7.1
print ("Hello, Dcoder!")
players = ["Akshit","Bhavya", "Hem", "Jayu", "Jay M", "Jay Savla", "Miraj", "Priyank", "PD", "Pratik"]
score = [0,0,0,0,0,0,0,0,0,0]
#0 = Akshit
#1 = Bhavya
#2 = Hem
#3 = Jayu
#4 = Jay M
#5 = Jay Savla
#6 = Miraj
#7 = Priyank
#8 = PD
#9 = Pratik
#10 = Shamu
print (players)
print (score)
players.append("Shamu")
score. append(0)
#RRvCSK
score[9] = (score[9]+100)
score[7] = (score[7]+50)
score[4] = (score[4]+30)
print ("Result")
print (players)
print (score)
Output:
zip
1 makes an iterator by aggregating elements from each of the iterables (here, we haveplayers
andscore
lists). Every element fromplayers
andscore
are taken together and then printed to the console on the next line.