Jun-05-2019, 12:22 PM
Problem description :
Write a function called unique_english_letters that takes the string word as a parameter. The function should return the total number of unique letters in the string. Uppercase and lowercase letters should be counted as different letters.
We’ve given you a list of every uppercase and lower case letter in the English alphabet. It will be helpful to include that list in your function.
I have written the code :
Write a function called unique_english_letters that takes the string word as a parameter. The function should return the total number of unique letters in the string. Uppercase and lowercase letters should be counted as different letters.
We’ve given you a list of every uppercase and lower case letter in the English alphabet. It will be helpful to include that list in your function.
I have written the code :
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" # Write your unique_english_letters function here: def unique_english_letters (word) : counter = 0 for i in letters : if i in word : counter += 1 return counter # Uncomment these function calls to test your function: print(unique_english_letters("mississippiiiii")) # should print 4 print(unique_english_letters("Apple")) # should print 4But I don't understand the logic. Can anyone explain me the logic in simple terms ?