+ 1

Help with dictionary

https://code.sololearn.com/ca7A22a24a25 dont worry that it doesnt line up in the code I already figured how to format it out...but my question is this as you can see I was able to get each word to print on a new line and have its frequency appended to it my problem is that I also need to append the line that it appears on after that so here is an example below WORD INFO ---------------------------------------------------- WORD FREQUENCY LINES ---------------------------------------------------- We 1 1 ### right here i need the line numbers that a 2 1 2 ###words occur on appended I'm only just an 1 3 as 4 4 5 ###<< as occurs twice on line 4 and 5 but ### dont want it to repeat like 4 4 5 5

25th Mar 2021, 12:08 AM
Gutz_X_73vEn
Gutz_X_73vEn - avatar
4 Answers
+ 2
Not the most elegant solution but here you go https://code.sololearn.com/cs8TIMi20v8m/?ref=app I made some minor changes in your code. You can obviously optimize the formatting for your taste
25th Mar 2021, 2:05 AM
Benjamin JĂŒrgens
Benjamin JĂŒrgens - avatar
+ 2
Benjamin JĂŒrgens thank you that makes sense do you think you can teak it just a tiny bit to where it will call the line thats index is 0 1 you know what i mean? so that it will be 1-5 instead of 0-4
25th Mar 2021, 2:18 AM
Gutz_X_73vEn
Gutz_X_73vEn - avatar
+ 2
Gutz_X_73vEn sure, just add 1 to the dict entries in line 40
25th Mar 2021, 2:25 AM
Benjamin JĂŒrgens
Benjamin JĂŒrgens - avatar
+ 1
Benjamin JĂŒrgens Oh wow thats great! thank you so much lol my professor hasnt even taught us dictionaries yet but our assignment calls for it so ive been struggling trying to figure it out !(:
25th Mar 2021, 2:30 AM
Gutz_X_73vEn
Gutz_X_73vEn - avatar