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
Which of the following is not considered a system component that can be found inside a computer? A-CPU B-RAM C-PCIe graphics ada
Julli [10]

The answer is C) PCIe graphics adapter, because it is not required for the computer to work.

8 0
3 years ago
In C, a switch construct can have ________ number of default case(s). *
azamat

I think so that it will be zero or more

7 0
3 years ago
he timing device in an automobile’s intermittent wiper system is based on an RC time constant and utilizes a 0.500-μF capacitor
Tatiana [17]

Answer:

4000k-ohm to 10,000k-ohm

Explanation:

As we know that time constant for an RC circuit is t=RC

Putting the values of t we can get the range of varaiable resistor as;

t=RC

Putting t=2 we get the first value of the range for the variable resistor

2=R*0.500*10^-6

R=2/(0.500*10^-6)

R=4*10^6

R=4000k-ohm

Now putting t=5 we get the final value for the range of variable resistor

t=RC

5=R*0.500*10^-6

R=5/(0.500*10^-6)

R=10*10^6

R=10,000k-ohm

So variable resistance must be made to vary in the range from 4000k-ohm to 10,000k-ohm

5 0
3 years ago
My ar goal is 16.3 what percent am i at if i have 3 points??
Mazyrski [523]

24 percent so far so keep working at that goal

5 0
3 years ago
What are the risks associated with this kind of connectivity?.
Eva8 [605]

Answer:

The risks associated with this kind of connectivity are that online hackers may see your information and that makes the human race too dependent on robots and technology which is never a good thing.

Explanation:

<h3>be happy</h3>
8 0
2 years ago
Other questions:
  • explain the key reasons why entity relationship modeling is important, and determine at least (1) way in which it impacts the ov
    5·1 answer
  • A hard drive cannot be partitioned until the device _________ is set.
    15·1 answer
  • Question 1 (1 point)
    10·2 answers
  • To what extent can u justify that computer is not the only ICT tool?​
    9·1 answer
  • If the variable letter has been defined as a char variable, which of the following are not valid assignment statements to assign
    8·1 answer
  • What is the difference between = and == in terms of java..?
    6·2 answers
  • What is a file type and why is it important? Give at least three examples of file
    7·1 answer
  • In order to enhance the training experience and emphasize the core security goals and mission, it is recommended that the execut
    5·1 answer
  • 9. Themes can be modified using variants. *<br><br>True<br>False​
    7·2 answers
  • What are the two protocols used most often with iot devices? (select two. )
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!