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
lara [203]
3 years ago
10

Write a program that reads a file that contains only integers, but some of the integers have embedded commas, as in 145,020. The

program should copy the information to a new file, removing any commas from the information. Do not change the number of values per line in the file.
Computers and Technology
1 answer:
PtichkaEL [24]3 years ago
4 0

Answer:

with open("integer_file.txt", "r") as file:

   book = file.read().strip()

   pages = book.split(" ")

   for page in pages:

       if "," in page:

           comma_rm = page.replace(",","")

           print(comma_rm)

       else:

           print(page)

Explanation:

The python program opens a text file (Assuming the file contains only integers but are in string form eg: 5 in '5' for string), reads the whole content of the file as a string, splits it to a list of strings and iterates through to remove commas in the number string and display the elements.

You might be interested in
You can sort data in a table or_____?<br><br><br> A. Report<br> B. Form<br> C. Field<br> D. Record
Mazyrski [523]

Answer:I believe its form

Explanation:

7 0
3 years ago
Read 2 more answers
30% of the mass of an objects is 24 kilograms. use this fact to find:
Triss [41]

Answer:

chemați. mfvd5. fn. cfcfcfcfcfcfcf 4t

6 0
3 years ago
Besides the decimal number system that is most common (base 10), two other number systems that can be used in c++ programs are _
Paha777 [63]

Answer:

Binary number system

ASCII number system

Explanation:

C++ uses binary number system to define machine level language of the code written in high level languages and ASCII system to define the characters on key board for background low level coding an thus each character on the keyboard has a number associated with it to define it uniquely.

7 0
3 years ago
A method variable a class variable with the same name. a) acquiesces to b) destroys c) overrides d) alters
arlik [135]

Answer:

Option(c) is the correct answer for the given question.

Explanation:

The method variable overrides the class variable name with same name The method variable overrides of the class variable name .

Following are the example in java language

public class Main

{

int b=90; // class varaible or instance varaible

void sum()

{

   int b=34; // method having same name as class varaible name

   b=b+10;

   System.out.println(b); // display b

}

public static void main(String[] args)  // main method

{

 Main ob=new Main(); // craete object

 ob.sum(); // calling method sum

}

}

Output:

44

In this we declared a variable 'b' as int type in class and override this variable in sum() function it means same variable name is declared in function sum() .

acquiesces ,destroys,alters are the wrong for the given question.

So overrides is the correct answer

4 0
4 years ago
PLEASE ANSWER ASAP! THANKSSSSS
tankabanditka [31]
That is hard .....……
5 0
3 years ago
Other questions:
  • Alexandria works for a non-for-profit company that asks for donations to help the homeless people in her community. Recently the
    8·1 answer
  • Which type of network cover a large geographical area and usually consists of several smaller networks, which might use differen
    5·1 answer
  • There is a simple pattern for determining if a binary number is odd. What is it and why does this pattern occur
    6·2 answers
  • 1.2 Discuss each of the following terms: (a) data (b) database (c) database management system (d) database application program (
    12·1 answer
  • What command can be used to export an nps backup file named npsconfig.xml that can be used to restore nps configuration on anoth
    12·1 answer
  • Henry, a graphic artist, wants to create posters. Which software should Henry use for this purpose?
    13·1 answer
  • Where in the Formula tab on the ribbon would you find the Use in Formula function?
    11·2 answers
  • Class C Airspace inner ring begins at the __________ and extends vertically (by definition) to MSL charted values that generally
    5·1 answer
  • A Consider the following method definition. The method printAllCharacters is intended to print out every character in str, start
    11·1 answer
  • Do yall think I should be lonely and quit life!!
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!