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]
3 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]3 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
Given three packets of size 2,500 Bytes (caution this is Bytes not bits) each are ready inside computer 1 to be transmitted onto
gizmo_the_mogwai [7]

Answer: umm sorry

Explanation:

5 0
3 years ago
House real estate summary Sites like Zillow get input about house prices from a database and provide nice summaries for readers.
Ksivusya [100]

Answer:

current_price = int(input("Enter the current price: "))

last_months_price = int(input("Enter the last month's price: "))

print("This house is $" + str(current_price))

print("The change is $" + str(current_price - last_months_price) + " since last month")

print("The estimated monthly mortgage is ${:.2f}".format((current_price * 0.051) / 12))

Explanation:

Ask the user to enter the current price and last month's price

Print the current price

Print the change in the price, subtract the last month's price from the current price

Print the estimated monthly mortgage, use the given formula to calculate, in required format

6 0
3 years ago
: Write a function "def countWords(string)" that returns a count of all words in an input string represented by the variable 'st
Zina [86]
We can define a word as a group of characters without a space between them. To find the words of the input string , w can use split(delimiter) which returns a list of strings which had the defined delimiter between them in the input string.

def countWords(string):
words = string.split(" ")
count = len(words)
return count

Here we set the delimiter as the space character, and returned the length of the words list. I split each step into its own line for readability, however the function could be one line:

return len(string.split())

Here, no delimiter is specified. If one isn't given, it will default to split at any whitespace, including space.

3 0
3 years ago
Which one of the patterns have the highest pitch?​
fomenos

Answer:

The answers is B

3 0
2 years ago
Read 2 more answers
What is the most complex part of a PC?
rjkz [21]

Answer:

From a hardware standpoint, the CPU is most likely the main component. From a software standpoint, macOS and Windows are complex software systems.

Explanation:

6 0
2 years ago
Other questions:
  • Why do many administrators choose to use a command line interface on a Linux server?
    12·1 answer
  • bj;ljfg'cfmb dfl kbslf jflk[gkdblkfd lbrkjlfbbfkjbdfjkbadbjbbkvbk'lbk'blbf;l;lkb lm;flklmkjlvkljvkljvbfbdsjsfbbjjlkbfjklbkfj'lgg
    9·2 answers
  • Suppose that we have a set of activities to schedule among a large number of lecture halls, where any activity can take place in
    8·1 answer
  • What is the most likely result of making a plan for life after high school
    14·1 answer
  • How can I make a website login system with only using php?​
    6·1 answer
  • The _____ method randomly rearranges the items in the list provided in the parentheses.
    5·2 answers
  • Keyshia wants to add movement to her PowerPoint presentation. Which tab should she use to complete this task
    15·2 answers
  • 7.2 code practice edhesive. I need help!!
    13·1 answer
  • What is a database and provide 2 examples of how you are using a database.
    5·1 answer
  • High-level languages must be translated into machine language before they can be executed. _________________________
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!