dimanche 5 mai 2019

Need explanation about forloop code in python

i found below python "for loop" online and its syntax differs from other codes , i like to know about :

  1. why the 'key' is in front of for loop
  2. why there is a if statement inline

CODE:

input = "codeforcode"

freqDict = Counter(input)

freq1 = [ key for (key,count) in freqDict.items() if count==1]


further i like to have web links to understand "for loop" more depth in python.

Aucun commentaire:

Enregistrer un commentaire