def file_read_func(string):
x=open(string)
sum=0
try:
for line in x:
sum=sum+1
print("Line count",sum)
except:
return -1
def file_read_func(string):
x=open(string)
sum=0
try:
for line in x:
sum=sum+1
print("Line count",sum)
except:
return -1
Is my program correct??
Please clarify.
On lab it tells me no such file
Please clarify.
def file_read_func(string):
try:
x=open(string)
sum=0
for line in x:
u=line.split()
for words in u:
a=len(words)
#a+=0
sum+=a
print("word count",sum)
except:
return -1
What is the problem with this code??