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
andreyandreev [35.5K]
4 years ago
10

The following code processes a file containing five positive numbers. What will the variable $result contain after the code is e

xecuted? Be careful! $result = 0; $someFile = fopen("some-file.txt", "r"); for ($count = 1; $count <= 5; $count = $count + 1) { $nextNum = fgets($someFile); } $result = $result + $nextNum; fclose ($someFile); print ("The result is $result ");
Computers and Technology
1 answer:
jolli1 [7]4 years ago
6 0

Answer:

highest of five numbers in the file

Explanation:

  • This code reads the file "some-file.txt" and saves the result in variable "somefile"
  • The runs a for loop for a count of 5.
  • In each loop it compares the current value of the file with the value of the variable result and if the result is true it updates the value of the variable result.
  • At the end of this code the variable result will contain the highest value in the file "some-file.txt" and print it.

You might be interested in
Which type of software is for sale directly to consumers in stores and online?
Alex777 [14]

Answer: its b my guy

Explanation:

5 0
4 years ago
Create the logic for a game that simulates rolling two dice by generating two random numbers between 1 and 6 inclusive. The play
guajiro [1.7K]

Answer:

The solution code is written in Python 3.

  1. import random  
  2. count = 0
  3. flag = False
  4. guess = int(input("Input your guess (2-12): "))
  5. while(count <=3):
  6.    dice1 = random.randint(1, 7)
  7.    dice2 = random.randint(1, 7)
  8.    if((dice1 + dice2) == guess):
  9.        flag = True
  10.    count += 1
  11.    
  12. if(flag):
  13.    print("User wins!")
  14. else:
  15.    print("Computer wins!")

Explanation:

A Random generator is needed for this question and therefore we start by importing Python random class (Line 1)

Next, create one counter variable,<em> count</em>, to ensure there will be only three rolling of the dices (Line 3).  We need another variable, <em>flag</em>, to track the status if the two dices equal to the <em>guess</em> number chosen by user (Line 4).

Next, prompt use to input a guess number (Line 5).

Within the while loop, we can use random class method <em>randint() to </em>generate random integer. The arguments 1 and 7 will give one random number ranged from 1 to 6 for <em>dice1</em> and<em> dice2</em>, respectively (Line 8 - 9).

If the total of<em> dice1 + dice2</em> equal to user <em>guess</em>, we turn the<em> flag </em>to <em>True</em>. If not, the <em>flag </em>will remain <em>False</em> after completing entire while loop.

If the <em>flag </em>turned to <em>True</em>, print the message "User Wins!" else print the message ("Computer wins!")

8 0
4 years ago
Which of the following explains why computers can be used in accounts payable? Computers can use random steps to identify the du
Sphinxa [80]

Answer:

Its A buddy

Explanation:

that what it was on ingenuity

4 0
3 years ago
Read 2 more answers
Alternatively, you can use a _______ to play a video on your web page.
geniusboy [140]
Ahh XD well ill get points for it so the answer is C  as seen on page 210 in the book HTML and CSS by Jon Duckett
8 0
4 years ago
You are writing a program to help compare two sports teams. A sample member of the list scores is [2. 5] where your team scored
Slav-nsk [51]

Answer:

The correct answer is C

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Friedman (1999) argues that "we are wrong to base health promotion in all societies on a Western framework for human development
    11·1 answer
  • What mistake do you think you might make related to changing the data in a cell that's used in a formula?
    14·1 answer
  • Which flowchart symbol indicates the start or the end of a process?
    8·1 answer
  • Which key is used to indent the first line of a paragraph to the right?
    15·2 answers
  • In client server network, there is no central server //// true or false​
    8·1 answer
  • Whats the best way to get into a computers programming to get past firewalls
    15·2 answers
  • What is the command for basic router configuration?
    6·1 answer
  • D. Chipboard
    14·1 answer
  • When is 1600 plus 25 and 1700 minus 35 the same thing?​
    10·1 answer
  • A sequential algorithm is broken into three stages
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!