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
I need help making this table in html code I have some of chart done but idk where to go after the 6:30pm part
Bumek [7]

dvioubfeevuf is hsvqvuvsqv

5 0
3 years ago
In which generation microprocessor was developed short answer of computer science​
3241004551 [841]

Explanation:

in fourth generation microprocessor was developed.

may it helped u

5 0
3 years ago
List and the deference between MS access objects​
Dafna11 [192]

Answer:

MS access objects help the user list , information and designed reports .

Explanation:

MS access objects are create a forms, data base, tables,queries, and modules. There are many objects are following:-Tables, Forms,Reports, Queries.

Table:- These are objects used into a define and store the data,tables are contain the columns and the store of different data.

Form:- Form is the object that designed by the data input and control application queries or tables, forms are used in viewing records.

Reports:- Reports are the designed to the printing and calculating data,reports are used because data in read to easy format.

Queries:- Queries are provides that data from one or more table,you can define the update ,delete, insert, select data.

4 0
3 years ago
#A year is considered a leap year if it abides by the #following rules: # # - Every 4th year IS a leap year, EXCEPT... # - Every
lara [203]

Answer:

To check if the year comes under each 100th year, lets check if the remainder when dividing with 100 is 0 or not.

Similarly check for 400th year and multiple 0f 4. The following C program describes the function.

#include<stdio.h>

#include<stdbool.h>

bool is_leap_year(int year);

void main()

{

int y;

bool b;

 

printf("Enter the year in yyyy format: e.g. 1999 \n");

scanf("%d", &y);     // taking the input year in yyyy format.

 

b= is_leap_year(y);  //calling the function and returning the output to b

if(b==true)

{

 printf("Thae given year is a leap year \n");

}

else

{

 printf("The given year is not a leap year \n");

}

}

bool is_leap_year(int year)

{

if(year%100==0)   //every 100th year

{

 if(year%400==0)   //every 400th year

 {

  return true;

 }

 else

 {

  return false;

 }

}

if(year%4==0)  //is a multiple of 4

{

 return true;

}

else

{

 return false;

}

}

Explanation:

Output is given as image

5 0
3 years ago
What does an effect allow you to do in<br> EarSketch?
Gnoma [55]

Answer:usbebdos did did I’d did d

Explanation:

Bash six ska over five. I did a sis a and

7 0
3 years ago
Other questions:
  • Use ________ resolution when recording human speech in an audio file.
    14·1 answer
  • Your sister is considering purchasing a tablet computer that utilizes RT as the
    11·1 answer
  • Place the steps in order to keep a graphic from spilling over into the next page and to include the text it is assciated with.
    12·1 answer
  • Which industry has the highest employment figure for both teen and young adults in July, 2014?
    6·1 answer
  • You have been asked to report on the feasibility of installing an IP CCTV camera system at your organization. Detail the pros an
    5·1 answer
  • As part of the systems engineering development team, use IDEF0 to develop a functional architecture. The functional architecture
    13·1 answer
  • Which of the following is a scam in which a perpetrator sends an official looking e-mail that attempts to obtain a user’s person
    7·2 answers
  • Even if you cannot afford it you should donate at least 5 of your earnings to charity true or false
    8·1 answer
  • What statement describes the last step in evaluating<br> information?
    10·1 answer
  • consider a pipelined risc cpu with 14 stages. what is maximum speedup of this cpu over a non-pipelined implementation?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!