CodeSolved

Solved Programming Questions & Exercises

List of Students' Scores

Practice Easy 69/ Download 3580 Views Most popular

Write a program that prints each student's name according to the list below and prints his front star as much as his / her rating.


To solve this question try to use your rings in u


Amir 5
Hooshang 7
reza 12
Mohsen 8
Mohammad 10


amir *****
Hooshang *******
........

19 Answers

Names = ['amir' , 'hooshang' , 'reza' , 'mohsen' , 'mohammad']
Scores = [5 , 7 , 12 , 8 , 10]

for i,name in enumerate(Names):
    print(name , end=' ')
    for s in range(Scores[i]):
        print('*', end='')
    print('') 
Khodepouyan Download Python New
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
name_scores = [
    ("amir", 5),
    ("hooshang", 7),
    ("reza", 12),
    ("mohsen", 8),
    ("mohammad", 10)
]
for item in name_scores:
    stars=""
    for i in range(item[1]):
        stars+="*"
    print(item[0],stars)
Saeeda33 Download Python
names=['mahdi','safoora','hoora','javad','reihane']
s=[14,5,7,9,13]
for index, (name,ss) in enumerate(zip(names,s), start=1):
    print(index, name, '*' * ss)
names = [
    {'name' : 'amir','score' : 5},
    {'name' : 'hooshang','score' : 7},
    {'name' : 'reza','score' : 12},
    {'name' : 'mohsen','score' : 8},
    {'name' : 'mohammad','score' : 10},
]
for i in names:
    print(f"{i['name'] :10} {i['score'] * '*'}")
stu = ["amir","hooshang","reza","mohsen","mohammad"]
num = [5,7,12,8,10]
for j in range (len(num)):
    print(stu [j]  , (num[j])*"*" )
Esmaeelphy Download Python
stu = ["amir","hooshang","reza","mohsen","mohammad"]
num = [5,7,12,8,10]
x = 0
while x < (len(stu)):
    print (stu [x] ,end=" " )
    y=1
    while y <= (num[x]):
        print("*",end="")
        y += 1
    x += 1    
    print()
Esmaeelphy Download Python
name = [("amir",5),('hooshang',7),("reza",12),("mohsen",8),("mohammad",10)]
for n , s in name:
    student = n
    stars = '*'*s
    print(f"name: {student} , score: {stars}")
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

×
×
Close