CodeSolved

Solved Programming Questions & Exercises

List of Students' Scores

Practice Easy 69/ Download 4228 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

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.
students_scores = [
    ("amir", 5),
    ("hooshang", 7),
    ("reza", 12),
    ("mohsen", 8),
    ("mohammad", 10)
]

# Browse the list of students
for student in students_scores:
    name = student[0]  # Name of the student
    score = student[1]  # Student score
    
    # Print the name of the student
    print(name, end=' ')
    
    # Print stars as points
    for _ in range(score):
        print('*', end='')
    
    # Print a new line
    print()  # This line is to go to the new line
Mma123 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}")
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
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

×
×
Close