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
The first real computer was an abacus?
kotegsom [21]
True, false, false. Hope this helps:)
3 0
3 years ago
Identify the characteristics of logic problems. Select all that apply.
hoa [83]

Answer:

a problem that can be solved in a methodical manner

a problem solved with well-defined steps

6 0
2 years ago
Read 2 more answers
Change the file name for index.html to index.php
Damm [24]

The PHP code is given below:

<h3>PHP code</h3>

if(isset($_REQUEST['login_btn'])){

       $email = filter_var(strtolower($_REQUEST['email']),FILTER_SANITIZE_EMAIL); //strtolower changes email to all lower case

       $password = strip_tags($_REQUEST['password']);

The remaining code is in the file attached.

 

Read more about PHP here:

brainly.com/question/27750672

#SPJ1

Download txt
4 0
1 year ago
QUESTION
Lady_Fox [76]

Answer:

Explanation:

#include <iostream>

using namespace std;

int main ()

{

   int responses[30],count[6];

   int score = 0;

   string resp = " ";

   for (int i = 0; i < 30; i++)

   {

    responses[i] = 0;

   }

   for (int i = 0; i < 6; i++)

   {

    count[i,1]=0;

    count[i,2]=0;

    count[i,0]=0;

   }

   while ((resp != "Y") && (resp != "y"))

   {

    for (int i = 0; i < 30; i++)

    {

        while ((score > 5) || (score < 1))

           {

            cout << "Student " << (i+1)<< " please enter a value (1-5):";

            cin >> score;

        }

           responses[i] = score;

           if((score > 5)||(score<1))

           {

               if(score==1) count[1]++;        

               if(score==2) count[2]++;        

               if(score==3) count[3]++;        

               if(score==4) count[4]++;        

               if(score==5) count[5]++;        

           }

           score = 0;

    }

    cout<< "Response               Frequency              Percentage"<<endl;;

    cout<< "    1                      "<<count[1]<<"               "<<(count[1]/30)<<"%"<<endl;

    cout<< "    2                      "<<count[2]<<"               "<<(count[2]/30)<<"%"<<endl;

    cout<< "    3                      "<<count[3]<<"               "<<(count[3]/30)<<"%"<<endl;

    cout<< "    4                      "<<count[4]<<"               "<<(count[4]/30)<<"%"<<endl;

    cout<< "    5                      "<<count[5]<<"               "<<(count[5]/30)<<"%"<<endl;

    cout<< "Do you want to exit? Press Y to exit any other key to continue: ";

    cin>> resp;

   }

   return 0;

}

8 0
3 years ago
13. What is the suggested rpm on a hard drive for a laptop?
mario62 [17]
Usually it’s either 5400 or 7200RPM
3 0
3 years ago
Other questions:
  • The point at coordinates (2, -18) is in what direction from the origin?
    7·1 answer
  • The addElement operation for the linked implementation must determine the parent of the next node to be inserted. Why?
    5·1 answer
  • If you specify a user without specifying a hostname, mysql will
    13·1 answer
  • Why is a networked system a benefit?
    7·1 answer
  • Describe how communication strengthens relationship at work and, as a result, increases your productivity
    9·1 answer
  • How Do you get Splatoon two for free
    6·2 answers
  • How many people on here are doing edmentum online
    11·1 answer
  • D is the correct answer
    8·2 answers
  • Research and build a chroot jail that isolates ssh users who belong to the restrictssh group. (You will also need to create the
    9·1 answer
  • Help pweeze this is due today :(<br><br> I will give u brainliest just pweeze, I need this answer :(
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!