Question: Complete the code so it will read strings from a file and convert them to numbers. Replace 'FillThisIn' with missing code. # Expected output: #
Complete the code so it will read strings from a file and convert them to numbers. Replace 'FillThisIn' with missing code.
# Expected output:
# String converted to number:
# String converted to number:
# String 'ten' cannot be converted to number
# String cannot be converted to number
FillThisIn:
file openDataFiletxtr
FillThisIn:
printError: File not found"
exit
for line in file:
line line.rstrip
printfString line end
FillThisIn:
num floatline
printfconverted to number: num:f
FillThisIn:
printcannot be converted to number"
fileclose
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
