Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. def autocomplete1(word):
  2.     load_data = open("alphabetical.csv")
  3.     file_contents = load_data.readlines()
  4.     load_data.close()
  5.     lista = []
  6.  
  7.  
  8.  
  9.     for x in file_contents:
  10.         if x[0:len(word)] == word:
  11.             ord, frekvens = x.split(",")
  12.             lista.append([ord, int(frekvens)])
  13.  
  14.     largest = 0
  15.     for frekvens in lista:
  16.         if frekvens[1] > largest:
  17.             largest = frekvens[1]
  18.  
  19.     return largest
  20.  
  21. print(autocomplete1("a"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement