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
VikaD [51]
3 years ago
14

The readline method reads text until an end of line symbol is encountered, how is an end of line character represented

Computers and Technology
1 answer:
zhannawk [14.2K]3 years ago
3 0

Answer:

\n

Explanation:

readline() method is used to read one line from a file. It returns that line from the file.    

This line from the file is returned as a string. This string contains a \n at the end which is called a new line character.

So the readline method reads text until an end of line symbol is encountered, and this end of line character is represented by \n.

For example if the file "abc.txt" contains the lines:

Welcome to abc file.

This file is for demonstrating how read line works.

Consider the following code:

f = open("abc.txt", "r")  #opens the file in read mode

print(f.readline()) # read one line from file and displays it

The output is:

Welcome to abc file.    

The readline() method reads one line and the print method displays that line.                        

You might be interested in
Given that Jamie worked 50 hours (Hours = 50) last week and earns $10.00 an hour (Rate = 10), how much did Jamie earn last week,
quester [9]

Answer:

<em>Jamie earned (Total pay)  $500.</em>

<em></em>

Explanation:

We are given the following code:

<em>If (Rate >=10) OR (Hours <=40) Then </em>

<em>    TotalPay = Hours * Rate </em>

<em>Else </em>

<em>    TotalPay = (Hours * Rate)+(Hours–40)*Rate*1.5 </em>

<em>End If</em>

<em />

Let us understand the code line by line:

The first line contains an if statement with 2 conditions:

i.e. 1st condition:

The rate is greater than or equal to 10

2nd condition:

Number of hours are lesser than or equal to 40.

There is OR between the two condition i.e. the statement next to if() statement will get executed if any one of them becomes true and else part will not be executed.

The next statement is:

TotalPay = Hours * Rate

It calculates the pay if any of the two conditions written earlier becomes true.

Next statement is else statement:

It will get executed given that the above if() statement becomes false.

Now, we are given that Jamie worked 50 hours last week and earns $10.00 an hour:

i.e.

Hours = 50

Rate = 10

Now, let get to the code execution.

The first condition is true i.e. Rate >= 10 (because Rate is 10 here)

So, the following statement will be used to calculate the Total pay:

TotalPay = Hours * Rate

and else part will not be executed.

TotalPay = 50 * 10  =<em> $500  </em>

<em></em>

<em>Jamie earned (Total pay)  $500.</em>

3 0
3 years ago
Write the code to compute and output how many times the value 99 is found in an array of integers named numbers
astraxan [27]
Thank you for being the rare question where you actually provide what language you want your answer in; I approve, and encourage this.

In Java, the following will work.
I made it a bit more versatile to work with others numbers, other than 99, if you so please (if not, just hardcode the 99 in yourself).

// Example list - fill this with numbers yourself.
ArrayList<Integer> nums = new ArrayList<>();
int n = 99;
int count = (int)nums.stream().filter(i -> i == n).count();
System.out.println(n + " occurences.");
8 0
3 years ago
What is a good monitor for console gaming? (Any price)
likoan [24]

Answer:

I personally use a alienware

Explanation:

7 0
3 years ago
Read 2 more answers
The main path of the Internet along which data travels the fastest is known as the Internet ________. Group of answer choices
Svetradugi [14.3K]

Answer:

<em>Internet backbone</em>

Explanation:

The internet backbone is made up of multiple networks from multiple users. It is the central data route between interconnected computer networks and core routers of the Internet on the large scale. This backbone does not have a unique central control or policies, and is hosted by big government, research and academic institutes, commercial organisations etc. Although it is governed by the principle of settlement-free peering, in which providers privately negotiate interconnection agreements, moves have been made to ensure that no particular internet backbone provider grows too large as to dominate the backbone market.

7 0
3 years ago
What was the name of the first computer (machine) language?
Angelina_Jolie [31]

In 1957, the first of the major languages appeared in the form of FORTRAN. Its name stands for FORmula TRANslating system. The language was designed at IBM for scientific computing. The components were very simple, and provided the programmer with low-level access to the computers innards.


8 0
3 years ago
Read 2 more answers
Other questions:
  • When you park facing downhill and there is a curb, turn your wheels _____ the curb. When you park facing uphill and there is a c
    13·2 answers
  • Windows explorer has a pane located on the left side which can display the directory structure of one or more drives. what is th
    15·1 answer
  • A computer with a frequency 2 GHZ and its average cycle per instruction is 2. what is the MIPS of the computer?
    6·1 answer
  • How many people employed in the United States work in a job related to digital media?
    12·1 answer
  • The Apple iPhone was a revolutionary product when it was introduced in 2007. To what extent do you agree or disagree with this s
    8·1 answer
  • Write a c++ program to calculate the approximate value of pi using this series. The program takes an input n that determines the
    13·1 answer
  • Implement a program that manages shapes. Implement a class named Shape with a method area() which returns the double value 0.0.
    15·1 answer
  • Whats the most popular social networking in the philippines?
    10·1 answer
  • The most widely used computer device​
    6·2 answers
  • What's the difference between a robot and a machine?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!