What was the error in this program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
29th Aug 2020, 11:08 AM
Sindhuja Selvakumar
Sindhuja Selvakumar - avatar
5 Answers
0
https://code.sololearn.com/cXxZ7S3A2hmH/?ref=app Your code has indentation errors. Above code is clear code
29th Aug 2020, 11:18 AM
Allamprabhu Hiremath
+ 2
Sindhuja Selvakumar And You should enter all input at once
29th Aug 2020, 11:20 AM
Ajith
Ajith - avatar
+ 1
True not true And unnecessary indentations ,you can't just throw in a space or tab at any point , sum=0 count=0 average=0 while True: try: x=input("enter the input") if x=="done": break value=float(x) sum=value+sum count=count+1 average=sum/count except: print("invalid number") print (sum,count,average)
29th Aug 2020, 11:18 AM
Abhay
Abhay - avatar
+ 1
Very bad indentation: sum=0 count=0 average=0 while True: try: x=input("enter the input") if x=="done": break else: value=float(x) sum=value+sum count=count+1 average=sum/count except: print("invalid number") print (sum,count,average)
29th Aug 2020, 11:19 AM
Web-Learner
+ 1
Additional to above mentioned answers please note that while True together with interactive input of user data does not work here in Playground. The code can be i.e. looks like: https://code.sololearn.com/c6te60ps8DnA/?ref=app
29th Aug 2020, 12:05 PM
JaScript
JaScript - avatar