PYTHON: Write a function printPositive() that takes a string representing the na
ID: 3672978 • Letter: P
Question
PYTHON: Write a function printPositive() that takes a string representing the name of an input file as a parameter. The input file contains numbers (integer or floating point), one per line. The function reads the numbers from the file and prints the values that are greater than zero to the screen, one per line.
Python Shell Eile Edit Shell Debug Options Windows Help >printPositivenmsi.txt ) 12 17.99 85.3 50 >>printPositive ( nums2.txt') printPositive (' nuns1.txt 10 15 18.99 3.95 Ln: 85 Col: 4Explanation / Answer
def printPositive(fileName):
f = open(fileName, 'r')
for num in f:
if int(num) > 0 :
print num,' '
printPositive("num1.txt")