CodeSolved

A comprehensive source of programming questions and exercises

List of Students' Scores

Practice Easy 69/ Download 2341 Views

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 *******
........

15 Answers

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 = [
    {'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])*"*" )
User 3026 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()
User 3026 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}")
def star(name,nomre):
    for x in range(nomre+1):
        None
    print(f"{name}{x*"*"}")
star("amir ",5)
star("hooshang ",7)
star("reza ",12)
star("mohsen ",8)
star("mohammad ",10)
Yasin.hn Download Python
stuname=["amir","hooshang","reza","mohsen","mohammad"]
stuscore= [ 5,7,12,8,10]
for i,stuname in enumerate(stuname):
    print(stuname, end=" ")
    for s in range (stuscore[i]):
        print("*",end="")
    print("")
Chef.nasim Download Python
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close