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
Object-Oriented Programming (Using Java Language)
Delicious77 [7]

Answer:

import java.util.Scanner;

class Main {  

 public static void main(String args[]) {

       Scanner scan = new Scanner(System.in);

       System.out.print("Enter a decimal value (0 to 15): ");

       int num = scan.nextInt();

       scan.close();

       

       if (num < 0 || num >15) {

           System.out.printf("%d is an invalid input\n", num);

       } else {

           System.out.printf("The hex value is %X\n", num);

       }

 }

}

Explanation:

Hopefully this example will get you going for the other assignments.

3 0
2 years ago
Given the char * variables name1, name2, and name3, write a fragment of code that assigns the largest value to the variable max
Assoli18 [71]

Answer:

The following code as follows:

Code:

max=name1;   //define variable max that holds name1 variable value.

if (strcmp(name2, max)>0)  //if block.

{

   max=name2;  //assign value to max.

}

if (strcmp(name3,max)>0)   //if block.

{

  max=name3; //assign value to max.

}

Explanation:

In the above code, we define a variable that is max. The data type of max variable is the same as variables "name1, name2, and name3" that is "char". In the max variable, we assign the value of the name1 variable and use if block statement two times. In if block, we use strcmp() function that can be defined as:

  • In first if block we pass two variables in strcmp() function that is "name2 and max" that compare string value. If the name2 variable is greater then max variable value so, the max variable value is change by name2 variable that is "max=name2".
  • In second if block we pass two variables in strcmp() function that is "name3 and max" that compare string value. If the name3 variable is greater then max variable value so, the max variable value is change by name3 variable that is "max=name3".

4 0
2 years ago
You manage 20 windows workstations in your domain network you want to prevent the sales team members from making system changes
Rainbow [258]

Answer:

You should configure the user account control.

Explanation:

Behavior of the elevation prompt for standard users setting in Group Policy to Prompt for credentials.

4 0
3 years ago
Network Time Protocol (NTP) is designed to synchronize clocks of networked computers.
Gwar [14]

Answer: UDP port 123

Explanation:

UDP port 123 is used by NTP to synchronize ports of networked computers.

3 0
2 years ago
Explain in detail what it means to synchronize computers and mobile devices and include at least two strategies for keeping your
olya-2409 [2.1K]

Answer:

Explanation:

To synchronize computers and mobile devices means to use a cloud service that constantly checks to see if local files are up-to-date with the files in the cloud. These services update the cloud files with the local files if they are overwritten for maximum convenience.

Two strategies for keeping files in sync are using Dropbox. Another way is using iCloud if one has Mac/iOS devices.

7 0
2 years ago
Other questions:
  • Over time, programming languages have evolved in phases called ________.
    5·2 answers
  • Create a program that reads words.txt (link near top of our home page) in order to: determine the length of the longest word(s)
    14·1 answer
  • Select the correct answer. Larry finds it easy to run legacy programs and applications in a virtualized environment. How does th
    5·1 answer
  • Which system tool allows you to manage the available space on your hard disk to improve efficiency? A. ScanDisk B. Anti-Virus C.
    10·1 answer
  • IF ACCURATE = BRAINLY (if u answer rubbish randomness= reported AND if you got questions dont ask in answer slot= reported)
    13·1 answer
  • Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in
    11·1 answer
  • Which of the following combines something you know, such as a password, with something you are (a biometric device such as a fin
    13·1 answer
  • The length property of the String object returns
    15·1 answer
  • What are the values of the following expressions? In each line assume that,
    7·1 answer
  • Divide 111001 by 1101​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!