question archive I am having trouble printing ("*") if the score is over or equal to 100
Subject:Computer SciencePrice: Bought3
I am having trouble printing ("*") if the score is over or equal to 100. It needs to print under commendation chart side.
I know its an if statement.
if one_number >= 100:
print("*")
that needs to be entered to print in the commendation side of chart only if one_number is more then 100
Here is my code:
def main():
fil_inp_stu = open("student_test_scores.txt", "r")
print(" #tttScoretttCommendationn----------------------------")
one_score = fil_inp_stu.readline()
method_1_process_file_using_readline("student_test_scores.txt")
def comendation(x):
if one_number >= 100:
print("*")
def method_1_process_file_using_readline(str_filename):
file_numbers_inp = open(str_filename, "r")
total_numbers = 0
num_records = 0
one_number = file_numbers_inp.readline()
while one_number != "":
one_number = int(one_number)
total_numbers += int(one_number)
num_records += 1
print(f'{num_records:>3}',".",f'{one_number:>10}',sep = "")
one_number = file_numbers_inp.readline()
calc_avg_display(total_numbers, num_records)
file_numbers_inp.close()
num_records += 1
def calc_avg_display(p_total_numbers, p_num_records):
avg_of_numbers = p_total_numbers / p_num_records
print("")
print("# of records :" ,f"{p_num_records:>8}")
print("Total :" ,f"{p_total_numbers:>8.2f}")
print("Average :" ,f"{avg_of_numbers:>8.2f}")
main()