1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lyrx [107]
3 years ago
14

"Players The files SomePlayers.txt initially contains the names of 30 football play- ers. Write a program that deletes those pla

yers from the file whose names do not begin with a vowel."

Computers and Technology
1 answer:
kumpel [21]3 years ago
8 0

Answer:

I am writing a Python program that deletes players from the file whose names whose names do not begin with a vowel which means their names begin with a consonant instead. Since the SomePlayers.txt is not provided so i am creating this file. You can simply use this program on your own file.

fileobj= open('SomePlayers.txt', 'r')  

player_names=[name.rstrip() for name in fileobj]  

fileobj.close()  

vowels = ('a', 'e', 'i', 'o', 'u','A','E','I','O','U')

player_names=[name for name in player_names  

                     if name[0] in vowels]

fileobj.close()

print(player_names)

Explanation:

I will explain the program line by line.

First SomePlayers.txt is opened in r mode which is read mode using open() method. fileobj is the name of the file object created to access or manipulate the SomePlayers.txt file. Next a for loop is used to move through each string in the text file and rstrip() method is used to remove white spaces from the text file and stores the names in player_names. Next the file is closed using close() method. Next vowels holds the list of characters which are vowels including both the upper and lower case vowels.

player_names=[name for name in player_names  

                     if name[0] in vowels]

This is the main line of the code. The for loop traverses through every name string in the text file SomePlayers.txt which was first stored in player_names when rstrip() method was used. Now the IF condition checks the first character of each name string. [0] is the index position of the first character of each players name. So the if condition checks if the first character of the name is a vowel or not. in keyword is used here to check if the vowel is included in the first character of every name in the file. This will separate all the names that begins with a vowel and stores in the list player_names. At the end the print statement print(player_names) displays all the names included in the player_names which begin with a vowel hence removing all those names do not begin with a vowel.

You might be interested in
What is a man-in-the-middle attack​
VMariaS [17]

Answer: An attack where the attackers will interrupt a data transfer happening between parties and in which they will pretend to be the legitimate parties.

Explanation: For example think about two people writing letters to each other back and forth. However you, the attacker can intercept the letters and effectively change the message/contents of the letter going to the other person. This is probably not the best explanation, but simply put a man-in-the-middle attack is when an attacker interupts a transfer and pretends to be the legitimate source.

4 0
2 years ago
Read 2 more answers
You can use automatic link-checking software to identify invalid hyperlinks. if you find invalid links, what should you do next?
Solnce55 [7]
Correct the href value of the appropriate anchor.
7 0
2 years ago
Retail price data for n = 60 hard disk drives were recently reported in a computer magazine. Three variables were recorded for e
BlackZzzverrR [31]

Answer:

Explanation:

Base on the scenario been described in the question, We are 95% confident that the price of a single hard drive with 33 megahertz speed and 386 CPU falls between $3,943 and $4,987

7 0
3 years ago
How can you enter Task Manager in Windows? Select 3 options. press Ctrl + Shift + Tab press Ctrl+Alt+Delete and then click Task
Sophie [7]

Answer:

Please find the 3 options below.

Explanation:

To begin with, Task Manager in windows, is a monitor program that provides information or shows application and processes running on a computer. Task manager also provide insights about the general status of a computer. The three options for entering or accessing task manager in windows are:

1. Press Ctrl+Alt+Delete and then click Task Manager

2. Right-click the taskbar and choose Start Task Manager

3. Right-click the taskbar and choose Manage Tasks

5 0
3 years ago
. When would one use the analytic application fraud detection?
vaieri [72.5K]

Answer:Fraud detection through analytical method is used for detection of the fraud transactions,bribe activity etc in companies, business,etc. This techniques helps in the reduction of financial frauds in the organization, have the control over company to protect it,decrease in the fraud associated costs etc.

It has the capability of identifying the fraud which has happened or going to happen through the analytical ways and human interference. The organizations or companies require efficient processing and detection system for identification of such false happening.

4 0
3 years ago
Other questions:
  • What are some of the potential sources of risk in a systems analysis and design project? How does the project manager cope with
    6·1 answer
  • Technician A says that in any circuit, electrical current takes the path of least resistance. Technician B says that while this
    11·2 answers
  • Know when the double, int, String, and char data types are best used. Example: I would store a social security number in a strin
    7·1 answer
  • When measuring processor speed,a megahertz is much faster than a gigahertz.true or fals
    12·1 answer
  • Write a pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0
    9·1 answer
  • Which of these is an example of input?
    6·1 answer
  • Which type of computer is used to process large amount of data​
    15·2 answers
  • Which term best describes these lines?
    7·1 answer
  • Can you explain the difference between software and hardware? Tell me 3 examples of each one.
    10·1 answer
  • Electronic evidence on computer storage media that is not visible to the average user is called​ ________.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!