0

in the 3 and 4 lines why he took "c" and what does it mean? anyone plz

The next part of the program finds what percentage of the text each character of the alphabet occupies. def count_char(text, char): count = 0 for c in text: if c == char: count += 1 return count filename = input("Enter a filename: ") with open(filename) as f: text = f.read() for char in "abcdefghijklmnopqrstuvwxyz": perc = 100 * count_char(text, char) / len(text) print("{0} - {1}%".format(char, round(perc, 2)))

3rd Jul 2017, 3:39 PM
Edu Rut
Edu Rut  - avatar
1 Respuesta
+ 2
basically they name the parameter 'c' lol like def some_function(x): there im naming my parameter x same thing goes to for, i can actually do for my_parameter in text: but they chose c because its short so yeah
3rd Jul 2017, 3:49 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar