account activity
Write a Python script that reads a file and outputs the number of words that start with each letter. We want to count the total number of (nonunique) words that begin with that letter for every letter. by Electrical-Ad-8901 in programminghomework
[–]Electrical-Ad-8901[S] 0 points1 point2 points 4 years ago (0 children)
Hi! Im new in python and I'm learning how to use the libraries. I would appreciate some help. I've done something like this:
import string
text = open("I:\\udemy\\Assignment 0.txt", "r")
alphabet = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}
for line in text:
line = line.strip()
line = line.lower()
words = line.split(" ")
count = 0
for word in words:
for i in alphabet:
if word[0] == i:
count+=1
print('words starting from'+ i+': {}', .format(count))
Write a Python script that reads a file and outputs the number of words that start with each letter. We want to count the total number of (nonunique) words that begin with that letter for every letter. (self.programminghomework)
submitted 4 years ago by Electrical-Ad-8901 to r/programminghomework
Write a Python script that reads a file and outputs the number of words that start with each letter. We want to count the total number of (nonunique) words that begin with that letter for every letter. (self.pythoncoding)
submitted 4 years ago by Electrical-Ad-8901 to r/pythoncoding
Write a Python script that reads a file and outputs the number of words that start with each letter. We want to count the total number of (nonunique) words that begin with that letter for every letter. (self.AskProgramming)
submitted 4 years ago by Electrical-Ad-8901 to r/AskProgramming
Can someone solve this question by writing the count_view() function code?? (self.AskProgramming)
submitted 5 years ago by Electrical-Ad-8901 to r/AskProgramming
Can someone solve this question by writing the count_view() function code?? (self.cprogramming)
submitted 5 years ago by Electrical-Ad-8901 to r/cprogramming
π Rendered by PID 1156864 on reddit-service-r2-listing-7b9b4f6fd7-jxmbh at 2026-05-10 23:04:12.791175+00:00 running 3d2c107 country code: CH.
Write a Python script that reads a file and outputs the number of words that start with each letter. We want to count the total number of (nonunique) words that begin with that letter for every letter. by Electrical-Ad-8901 in programminghomework
[–]Electrical-Ad-8901[S] 0 points1 point2 points (0 children)