https://onlinegdb.com/B1gvhAZZw
f = open("text.txt", "r")
s=f.read();
L=[0,0,0,0];
for i in range(len(s)):
if(s[i]>='a' and s[i]<='z'):
L[0]+=1;
if(s[i]>='A' and s[i]<='Z'):
L[1]+=1;
if(s[i]>='0' and s[i]<='9'):
L[2]+=1;
if(s[i]==' '):
L[3]+=1;
print("Number of uppercase characters in the file are:
"+str(L[1]));
print("Number of lowercase characters in the file are:
"+str(L[0]));
print("Number of digits in the file are: "+str(L[2]));
print("Number of whitespace characters in the file are:
"+str(L[3]));

Kindly revert for any queries
Thanks.
python question! points) Attached to the Exam #4 code Assignment in Tracs you ## will find...
i
need the answer for this python question using dictionary method
please!!!
points) Attached to the Exam #4 code Assignment in Tracs you ## will find a file, "text.txt". Text is stored 1 sentence per line. ## Write a program below that reads the file contents and displays ## the following: 1. Number of uppercase characters in the file 2. Number of lowercase characters in the file 3. Number of digits in the file. 4. Number of whitespace characters in...
PYTHON, write a function that accepts a text file's name and returns a. the number of uppercase letters in the file b. the number of lowercase letters in the file c. the number digits in file d. the number of whitespace characters in the file
Python Programming 4th Edition: Need help writing this program below. I get an error message that says that name is not defined when running the program below. My solution: def main(): filename = "text.txt" contents=f.read() upper_count=0 lower_count=0 digit_count=0 space_count=0 for i in contents: if i.isupper(): upper_count+=1 elif i.islower(): lower_count+=1 elif i.isdigit(): digit_count+=1 elif i.isspace(): space_count+=1 print("Upper case count in the file is",upper_count) print("Lower case count in the file is",lower_count) print("Digit count in the file is",digit_count) print("Space_count in the file is",space_count)...
You're to write a C++ program that analyzes the contents of an external file called data.txt. (You can create this file yourself using nano, that produces a simple ASCII text file.) The program you write will open data.txt, look at its contents and determine the number of uppercase, lowercase, digit, punctuation and whitespace characters contained in the file so that the caller can report the results to stdout. Additionally, the function will return the total number of characters read to...
For this exercise code a program in python which will read the text from the file in.txt. Then this program converts all the lowercase letters to the corresponding uppercase letters. The results will be written to the file out.txt. The ide for python i am using is python 3.7 input: it will be cold as hell in the winter output: IT WILL BE COLD AS HELL IN THE WINTER
Python: The attached text file: https://drive.google.com/open?id=1Hcj4Ey4NbKHn5-vyF-foR3iny0aX8y1c Unique Words Write a program that opens a specified text file and then displays the number of unique words in the text file after stripping all the white spaces, comma, and the punctuation marks and a list of all the unique words found in the file. The list should be sorted in alphabetical order. The program should handle the ‘file not found’ error. Store each word as an element of list. Be sure not...
Could anyone please help with this Python code assignment? In this programming assignment you are to create a program called numstat.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The count of how many numbers are in the file. The average of the numbers. The average is the sum of the numbers divided by how many there are. The maximum value. The...
I am new to Python and
am having trouble coming up with writing code to the following
problem...
The program must:
Prompt for a file name
Opens that file and reads through the file
Displays a custom error message if the file does not exist
You can pull the hour out from the 'From ' line by finding the
time and then splitting the string a second time using a
colon.
From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008
Accumulated the...
Write a Python program to read lines of text from a file. For each word (i.e, a group of characters separated by one or more whitespace characters), keep track of how many times that word appears in the file. In the end, print out the top twenty counts and the corresponding words for each count. Print each value and the corresponding words, in alphabetical order, on one line. Print this in reverse sorted order by word count. You can assume...