Give a problem statement that requires you to develop a Python program that meets the following requirements
Code:
#Code to change all 4 character words to #### and 5 character words to @@@@@ 6 character words to !!!!!!
def fun(x):
ls=x.split(" ")
z=[]
st=""
for i in ls:
if len(i)==4:
z.append("####")
elif len(i)==5:
z.append("@@@@@@")
elif len(i)==6:
z.append("!!!!!!")
else:
z.append(i)
for i in z:
st=st+i+" "
return st
f = open("a.txt", "r")
x=f.readline()
f.close()
z=fun(x)
text_file = open("a.txt", "w")
n = text_file.write(z)
text_file.close()
print("The text has been changed and stored in a.txt")
Output:
a.txt before executing
a.txt after executing
Console output:
Give a problem statement that requires you to develop a Python program that meets the following...
1. You will develop a Python program to manage information about baseball players. The program will maintain the following information for each player in the data set: player’s name (string) team identifier (string) games played (integer) at bats (integer) runs scored (integer) hits (integer) doubles (integer) triples (integer) homeruns (integer) batting average (real) slugging percentage (real) The first nine items will be taken from a data file; the last two items will be computed by the program. The following formulas...
Develop a functional flowchart and then write a C++ program to solve the following problem. 1. Create a text file named c1.txt and write your brand of computer (like Dell, HP, etc) in the file. You will be reading the name of the file from the keyboard as a string, using the string class. Your program will also read the brand of your computer from the keyboard. The process of the file creation (name of the file, mode for opening...
Lab 1 Q1. Write a Python program with the following function building block. •All input values are to be taken fro m the user. •Ensure to check for possible error cases like mismatch of data type and input out of range, for every function. Function 1: countVowels(sentence) – Function that returns the count of vowels in a sentence. Function 2: Sum of all even numbers between two numbers, identify number of parameters Q2. Write a Python program that reads a...
Any little bit of information will be helpful. Thank you. Problem Statement You are to develop a program to read MotoGP rider information from an input file. You will need a MotoGpRider class whose instances will be used to store the statistics for a MotoGP motorcycle racer. The Rider class will have attributes for last name, first name, racing number, nation, motorcycle make, world championship points, world championship position, and an array that stores the number of top finishes (number...
Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. You should also have a parallel array to store the names of the 12 months. The program should read the Month's names, and the temperatures from a given input file called temperature.txt. The program should output the highest and lowest temperatures for the year, and the months that correspond to those temperatures. The program must use the following functions:...
In python, please code the following: Problem 4 Download the file ATLForecast.dat from canvas. You may wish to open it to inspect the contents (then close the file to ensure no file locking implications). This file contains the minimum forecast temperature for the next 10 days in Atlanta (I'm waiting for the cool weather to start). Write a program that reads in the contents of this file (see example provided below, usinga function within numpy to read in this text...
PLEASE DO THIS IN PYTHON!!!!!!!! 1.) For each lab program you develop, make sure to include the following header - replace the dots with your section #, semester, your full name, your instructor’s name, and lab #: Class: CSE 1321L Section: ... Term: ... Instructor: ... Name: ... Lab#: ... Make sure to put the correct comment character(s) before the above lines in each file. C# & Java use // for comments, Python uses a # Exercise #1:...
In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...
Write a program using python that reads from values from a text file and plots them using matplotlib. The input data for each graph is on three lines of the input textfile. The first line contains the x-coordiates of the points of the graph, and the second line contains the y-coordinates of the points of the graph that correspond, in the same order, to the x-coordinates on the first line. The third line in each group of three lines may...
Must be written in JAVA Code Write a program that will read in a file of student academic credit data and create a list of students on academic warning. The list of students on warning will be written to a file. Each line of the input file will contain the student name (a single String with no spaces), the number of semester hours earned (an integer), the total quality points earned (a double). The following shows part of a typical...