SHARE
TWEET

Untitled

a guest Feb 17th, 2020 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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"))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top