Python For Everybody Assignment 7.2 | Compute | extract floating point | Count lines | X-DSPAM |

preview_player
Показать описание

Coursera: Python For Everybody Assignment 7.2 program solution | Graded Assignment 7.2 Python For Everybody

Q.) 7.2 Write a program that prompts for a file name, then opens that file and reads through the file, looking for lines of the form:
X-DSPAM-Confidence: 0.8475
Count these lines and extract the floating-point values from each of the lines and compute the average of those values and produce an output as shown below. Do not use the sum() function or a variable named sum in your solution.

Coursera: Programming For Everybody Assignment 7.2 program solution Answer | Python for Everybody Graded Assignment 7.2 program solution.

Hello,
In this video, we discussed Coursera programming for everybody Graded Assignment 7.2 answer another way it's known as Python for everybody Exercise of chapter 7 (Files) Complete program

Thanks for watching!!

Please Subscribe to My Channel !!
Share The video || Like ✓ || Comment!!

🌺Other Assignments Solution🌺

#python #pythonforeverybody #py4e #Coursera #UniversityofMichigan #assignment #files #open #read #count #extract #floatingpoint #values #compute #average #mbox #txt #rstrip #code #print #integer
#technology #python3
Рекомендации по теме
Комментарии
Автор

can someone explain t= line.find('0')
number = float( line[t:])

dheeprakashbiswas
Автор

#Try this
fname = input("Enter file name: ")
count = 0
total = 0.0
fh = open(fname)
for line in fh:
if
sline = line.find(':')
tline = line[sline + 1:]
uline = tline.strip()
uline = float(uline)
count = count + 1
total= total + uline
average = total / count
print('Average spam confidence:', average)

saltech