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
Ksivusya [100]
2 years ago
9

The file includes 4993 tweets including the keyword 'election'. Each tweet is represented in a separate line. Write a program to

open the file and read through its lines, then only if a tweet includes a hashtag (a term beginning by the
Computers and Technology
1 answer:
Likurg_2 [28]2 years ago
7 0

Answer:

import re

with open("../../Downloads/Tweets.txt","r", encoding="utf-8") as tweets:

   myfile = tweets.readlines()

   for item in myfile:

       item = item.rstrip()

       mylist = re.findall("^RT (.*) ", item)

       if len(mylist) !=0:

           for line in mylist:

               if line.count("#") >=1:

                   ln = line.split("#")

                   dm = ln[1]

                   print(f"#{dm}")

Explanation:

The python source code filters the document file "Tweets" to return all tweets with a hashtag flag, discarding the rest.

You might be interested in
¿Qué significa PPO a nivel de programación?
aleksandr82 [10.1K]

Answer:

La programación procedimental o programación por procedimientos es un paradigma de la programación. Muchas veces es aplicable tanto en lenguajes de programación de bajo nivel como en lenguajes de alto nivel.

Explanation:

espero y te sirva

4 0
2 years ago
Write a program that generates 1,000 random integers between 0 and 9 and displays the count for each number. (Hint: Use a list o
masya89 [10]

Answer:

import random

count0, count1, count2, count3,

count4, count5, count6, count7,

count8, count9, i = [0 for _ in range(11)]

while i < 1000:

   number = random.randint(0,9)

   if number == 0:

       count0 = count0 + 1

   if number == 1:

       count1 = count1 + 1

   if number == 2:

       count2 = count2 + 1

   if number == 3:

       count3 = count3 + 1

   if number == 4:

       count4 = count4 + 1

   if number == 0:

       count5 = count5 + 1

   if number == 6:

       count6 = count6 + 1

   if number == 7:

       count7 = count7 + 1

   if number == 0:

       count8 = count8 + 1

   if number == 9:

       count9 = count9 + 1

   

   i = i+1

print("0's: "+ str(count0) + "\n"+ "1's: "+ str(count1) + "\n"+

"2's: "+ str(count2) + "\n"+ "3's: "+ str(count3) + "\n"+

"4's: "+ str(count4) + "\n"+ "5's: "+ str(count5) + "\n"+

"6's: "+ str(count6) + "\n"+ "7's: "+ str(count7) + "\n"+

"8's: "+ str(count8) + "\n"+ "9's: "+ str(count9) + "\n")

Explanation:

- Initialize variables to hold the count for each number

- Initialize <em>i</em> to control the while loop

- Inside the while loop, check for the numbers and increment the count values when matched.

- Print the result

5 0
2 years ago
To make a complicated task easier, use a _____.
tia_tia [17]
I believe the answer is B spread sheet because i use spread sheets to make my life easier. I organize info in a spread sheet then it is really easy to find.

hope this helps<span />
6 0
2 years ago
Your boss is trying to modify a PDF file that he made a year ago. He asks you what he can use to do this. Which of the selection
Masteriza [31]
The answer is b. Office 2013
3 0
3 years ago
Read 2 more answers
When an entrepreneur has three employees at a busy and growing software company, what is the primary responsibility of the entre
polet [3.4K]

To direct the employees and respond to any calls/emails regarding a problem or upgrade that should be changed/fixed. (I don't know if that's what you wanted)

4 0
3 years ago
Read 2 more answers
Other questions:
  • Aubrey didnt like to use graphics or images on her slides. She preferred to use only a title for her slides and bullet-poinged t
    14·2 answers
  • Siva added a "Contact Form" to her website.
    10·1 answer
  • Subana is writing a program which will calculate the mean average of a set of numbers by adding the numbers and dividing the res
    11·2 answers
  • Which of the following browsers was introduced with windows 10?
    10·1 answer
  • Who is your favorite smite god in Hi-Rez’s “Smite”
    14·1 answer
  • Hurry im TIMED
    8·1 answer
  • 1. Using a microphone to create an audio file to accompany a message is an example of how data is processed and sent to an outpu
    9·1 answer
  • Summary about Interface Design in system analysis
    12·1 answer
  • Write an answer in three to five sentences that describes the photo, explains what better lighting would mean for your photograp
    6·1 answer
  • which one of the following would not normally be found in an organization's information security policy?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!