Python looking to find an easier way to shorten my .casefold().count() -
my python code running fine code looks bit tedious , messy. wondering if there easier way write it. have text file , required find if letters 'aardvark' can found inside line.
if i.casefold().count('a') >= 3 , i.casefold().count('r') >= 2 , i.casefold().count('d') >= 1 , i.casefold().count('v') >= 1 , i.casefold().count('k') >=1:
if all( i.casefold().count(letter) >= 'aardvark'.count(letter) letter in 'aardvark')
kinda silly solution works
Comments
Post a Comment