BillBojangeles2000 commited on
Commit
a920608
·
1 Parent(s): 8bda403

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -109,12 +109,14 @@ for i in questions:
109
  submit_button = Quiz.form_submit_button("Submit")
110
 
111
  def calculate_average(numbers):
 
 
112
  numbers = [int(x) for x in numbers if isinstance(x, (int, str))]
113
 
114
 
115
  total = sum(numbers)
116
  average = total / len(numbers)
117
- return average
118
 
119
  if submit_button:
120
  for i, q in enumerate(questions): # This line was missing the enumeration
@@ -145,4 +147,4 @@ if submit_button:
145
  else:
146
  x = x + 1
147
 
148
- st.subheader(f'Your average score for the answers is {calculate_average(scores)}')
 
109
  submit_button = Quiz.form_submit_button("Submit")
110
 
111
  def calculate_average(numbers):
112
+ if numbers = []:
113
+ return f'has not been calculated yet.'
114
  numbers = [int(x) for x in numbers if isinstance(x, (int, str))]
115
 
116
 
117
  total = sum(numbers)
118
  average = total / len(numbers)
119
+ return f'is {average}%'
120
 
121
  if submit_button:
122
  for i, q in enumerate(questions): # This line was missing the enumeration
 
147
  else:
148
  x = x + 1
149
 
150
+ st.subheader(f'Your average score for the answers {calculate_average(scores)}')