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
yarga [219]
3 years ago
14

2. Create a file with the follow integer/string content and save it as fun.txt. 6 fun. 3 hello 10 <> 2 25 4 wow! Write an

interactive program called PrintStrings that: • Generates file name based on the file path entered by the user • Then read the file fun.txt and produce the following output on the console. fun.fun.fun.fun.fun.fun. hellohellohello <><><><><><><><><><> 2525 wow!wow!wow!wow! Notice that there is one line of output for each integer/string pair. The first line has 6 occurrences of "fun.", the second line has 3 occurrences of "hello", the third line has 10 occurrences of "<>", the fourth line has 2 occurrences of "25" the fifth line has 4 occurrences of "wow!". Notice that there are no extra spaces included in the output. You are to exactly reproduce the format of this sample output. You may assume that the input values always come in pairs with an integer followed by a String (which could be numeric, such as "25" above).

Computers and Technology
1 answer:
Nesterboy [21]3 years ago
8 0

Answer:

see explaination

Explanation:

I made use of python program to solve this.

text file name with fun.txt.

6 fun. 3 hello 10 <> 2 25 4 wow!

Program code:

import re

file = open('fun.txt','r') #for reading file

strings="" #declaring empty string

for k in file:

strings=strings+k #all character in file is storing in strings variable for do operations

pattern = '\s' #for pattern \s is for space

result = re.split(pattern, strings) #split the string with space

for k in range(len(result)): #loop through the list of string

if(k%2) == 0: #checking for integer to time of string

p=int(result[k])

print(result[k+1] *p) #print times of the string(k+1)

Check attachment for output

You might be interested in
Why don’t we need to know and memorize the IP addresses for our favorite websites?
Solnce55 [7]

Because we have the domain name system (DNS). It registers friendly names, e.g., google.com that represent IP addresses. Your computer will consult a DNS service to query the IP address for a domain name you enter, and under-the-hood the connection is made to the IP address.

4 0
4 years ago
If you witness physical bullying and want to help, what should you consider first?
SashulF [63]

Answer: C

Explanation:

5 0
3 years ago
A telephone repair technician uses a meter to measure voltage on a phone line. This meter is an example of _____.
frozen [14]
It is an example of hardware.
3 0
3 years ago
Read 2 more answers
You receive an e-mail that seems to come from your bank. Clicking on a link in the message takes you to a website that seems to
lions [1.4K]

Answer:

A Phishing Attack

Explanation:

The term "phishing" comes from the combination of the English term "fishing", which means to fish, with the term "phreak", often used to name the first telephony hackers.

It is a type of scam that uses technological mechanisms, usually based on messages, to persuade and deceive people, with a specific objective, which varies from attack to attack.

For example, sending you an email message with a link like a popular social media platform which is meant to trick you into submitting your login details thereby hacking into your account from the hacker's remote location.

3 0
3 years ago
Read 2 more answers
A combined counting and logical looping statement may be needed in the following situations: (a). The values stored in a linked
sergejj [24]

Answer:

a i think

Explanation:

5 0
2 years ago
Other questions:
  • A client contacted you to request your help in researching and supplying the hardware necessary to implement a SOHO solution at
    5·1 answer
  • 1) List at least five smaller behaviors you could break the complex behavior "brushing my teeth" into.
    14·2 answers
  • True or false? pressing Ctrl and S is a shortcut for saving
    15·2 answers
  • Write a python program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The n
    5·1 answer
  • Which of the following organizations offers a family of business management system standards that details the steps recommended
    12·1 answer
  • A video streaming website uses 32-bit integers to count the number of times each video is played. in anticipation of some videos
    14·1 answer
  • A) Importance of Software Engineering I​
    5·1 answer
  • Question # 2 Multiple Select You wrote a program to compare the portion of drivers who were on the phone. Which statements are t
    6·1 answer
  • List two examples of semiconductor materials​
    12·1 answer
  • ________ involves disconnecting individual users from their selected internet service providers and redirecting them to illegiti
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!