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
GarryVolchara [31]
2 years ago
6

Task 2

Computers and Technology
1 answer:
adelina 88 [10]2 years ago
3 0

The program is an illustration of file manipulations

<h3>What are file manipulations?</h3>

File manipulations are program statements that are used to write & append to file, and also read from the file

<h3>The actual program in Python</h3>

Assume the file name is top10.txt, the program in Python where comments are used to explain each line is as follows:

#This opens the file

a_file = open("top10.txt")

#This reads the file contents

file_contents = a_file.read()

#This prints the contents

print(file_contents)

Read more about file manipulations at:

brainly.com/question/15683939

You might be interested in
What does editing refer to
Reil [10]
Editing is the process of working over and revising a piece of work, whether that piece of work is in writing, audio, or visual mediums. Editing in computer terminology can mean to search for errors and revise.
3 0
3 years ago
Read 2 more answers
Tim is a project manager. He is brainstorming with his team about problems that could arise during the next phase of the project
Grace [21]

Answer:

b.

Explanation:

just took the quiz

8 0
2 years ago
A user is attempting to access a shared file locally on their workstation. The file has Full control NTFS permissions assigned,
BaLLatris [955]

Answer:

The answer is read only permission

Explanation:

The effective permission for the user is the read only permission.

8 0
3 years ago
The birthday problem is as follows: given a group of n people in a room, what is the probability that two or more of them have t
Julli [10]

Answer:

import random

def calc_birthday_probability(num_people):

   num_tries = 1e6

   num_duplicates = 0

   tries = 0

   while tries < num_tries:

       total_birthday = {}

       for i in range(1, 366):

           total_birthday[i] = 0

       for count in range(num_people):

           birthday = random.randint(1, 365)

           if total_birthday[birthday] != 0:

               num_duplicates += 1

               break

           total_birthday[birthday] += 1

       tries += 1

   return num_duplicates/num_tries

def main():

   num_people = 10

   p = calc_birthday_probability (num_people)

   print(p)

   num_people = 20

   p = calc_birthday_probability (num_people)

   print(p)

   return

if __name__ == "__main__":

   random.seed(2020)

   main()

Explanation:

  • Run the loop until the value of tries is less than num_tries to do number of trials.
  • Run the loop to create the desired number of birthdays by generating random numbers.
  • Increase  the num_duplicates  variable by 1, if the birthday has  already occurred.
  • Lastly define and then call the main function.

4 0
4 years ago
Here is the problem specification: An Internet service provider has three different subscription packages for its customers: Pac
Andrej [43]

Answer:

In C++:

#include <iostream>

using namespace std;

int main(){

   int hour; char pkg; float bill = 0;

   cout<<"Package: "; cin>>pkg;

   cout<<"Hour: "; cin>>hour;

   if(hour<=744 && hour >=0){

       switch (pkg) {

           case 'A':

               bill = hour * 9.95;

               if(hour >10){bill = 10 * 9.95 + (hour - 10) * 2;}

           break;

           case 'B':

               bill = hour * 14.5;

               if(hour >10){bill = 20 * 14.5 + (hour - 20) * 1;}

           break;

           

           case 'C':

               bill = 19.95;

           break;

           

           default:

               cout << "Package must be A, B or C";}

cout<<"Total Bills: $"<<bill; }

else{ cout<<"Hour must be 0 - 744"; }

return 0;

}

Explanation:

This declares all variables:    int hour; char pkg; float bill=0;

This prompts the user for package type:  cout<<"Package: "; cin>>pkg;

This prompts the user for number of hours:    cout<<"Hour: "; cin>>hour;

This checks if hour is between 0 and 744 (inclusive)

   if(hour<=744 && hour >=0){

If true, the following is executed

A switch statement to check valid input for package

       switch (pkg) {

For 'A' package

           case 'A':

Calculate the bill

<em>                bill = hour * 9.95;</em>

<em>                if(hour >10){bill = 10 * 9.95 + (hour - 10) * 2;}</em>

End of A package:            break;

For 'B' package

           case 'B':

Calculate the bill

<em>                bill = hour * 14.5;</em>

<em>                if(hour >10){bill = 20 * 14.5 + (hour - 20) * 1;}</em>

End of B package:<em>            </em>break;

For C package            

           case 'C':

Calculate bill:                bill = 19.95;

End of C package:            break;

If package is not A, or B or C

           default:

Prompt the user for valid package                cout << "Package must be A, B or C";}

Print total bills: cout<<"Total Bills: $"<<bill; }

If hour is not 0 to 744: <em>else{ cout<<"Hour must be 0 - 744"; }</em>

6 0
3 years ago
Other questions:
  • Using the slice operator, print your first, then last name.2. Print the length of your first name.3. Assume you have two variabl
    6·1 answer
  • Nadia's productivity at work is being hurt due to the large quantity of unwanted e-mail she receives. What steps can she take to
    8·1 answer
  • What Coding program does UNITY use?
    6·1 answer
  • Which of the following resources is an example of a web-based application?
    15·1 answer
  • A computer company has $3840000 in research and development costs. Before accounting for these costs, the net income of the comp
    5·1 answer
  • A programmer writing code in class Point attempts to override the following inherited method:public boolean equals( Object o ) {
    12·1 answer
  • Define the function max2 that takes two integers as arguments and returns the largest of them. Then define the function max_list t
    11·1 answer
  • 5. How many subnets are possible in a network with a /19 CIDR?
    5·1 answer
  • Please help thank you !!!
    7·2 answers
  • can you follow my ikok? its that_enby_skye and my youube Cactus Face with 241 subscribe er s &amp; my twith Mx_Skye
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!