Python Forum
how can rectify error from the below code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how can rectify error from the below code
#5
Hello! You pass to getingc1() "domain ontologies" as an argument. Print c1  before the return statement to see what is going out. You get a single list with a single value ' domain'.


In [9]: mystr = ['domain', 'ontologies']

In [10]: c1 = []

In [11]: for i in mystr[:1]:
    ...:     c1.append(i)
    ...:     

In [12]: c1
Out[12]: ['domain']
So in frequency1() you count for a string which is not in 'd'.
In [20]: print(termslist)

dict_items([])
 
So you get an empty container from which you return 'v'. In the end the returned value from frequency1 function is None. You can't divide None with something else.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
RE: how can rectify error from the below code - by wavic - Feb-28-2017, 09:59 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020