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
Leno4ka [110]
3 years ago
15

Write a program that reads in a text file, infile.txt, and prints out all the lines in the file to the screen until it encounter

s a line with fewer than 4 characters. Once it finds a short line (one with fewer than 4 characters), the program stops. Your program must use readline() to read one line at a time. For your testing you should create a file named infile.txt. Only upload your Python program, I will create my own infile.txt using break
Computers and Technology
1 answer:
ivanzaharov [21]3 years ago
8 0

Answer:

Explanation:

f=open("infile.txt","r")

flag=True

while(flag):

s=f.readline().strip()

if(len(s)>=4):

print(s)

else:

flag=False

You might be interested in
Which of the following is NOT a factor of identifying graphic design?
kolezko [41]

Answer:

i think it is a

Explanation:

sorry if it is wrong

4 0
3 years ago
Read 2 more answers
A ______ connection provides fast internet service and the ability to exchange large files. ​
Degger [83]

Answer:

broadband

Explanation:

A<u> broadband</u> connection  provides fast internet service and the ability to exchange large files. ​

3 0
3 years ago
Give two examples of non printing characters
VMariaS [17]
Space — each pressing of the key will be displayed as ·
Non-breaking space (°) is a space character that prevents an automatic line break at its position.
3 0
3 years ago
Use the modulo operator (%) to get the desired rightmost digits. Ex: The rightmost 2 digits of 572 is gotten by 572 % 100, which
uranmaximum [27]

Hi, you haven't provided the programing language in which you need the code, I'll just explain how to do it using Python, and you can apply a similar method for any programming language.

Answer:

def rightMost(num):

   lenNum = len(str(num))

   rightNum = num%(10**(lenNum-1))

   print(rightNum)

   return(rightNum)

Explanation:

In this function we receive an integer number, then we find how many digits this number has, and finally, we find the rightmost digits; the main operation is modulo (takes the remainder after a division), what we want is to take all the digits except the first one, for that reason we find the modulo of the number when divided by ten to the power of the length of the number minus one, for example, if the number is 2734 we divided by 10^(4-1), where four is the length of the number, this way we get 2734/1000 and the module of it is 734.

5 0
3 years ago
A decrease in the Short-Run Aggregate Supply Curve is associated with what?
hodyreva [135]
A shift Down,I guess......
3 0
3 years ago
Other questions:
  • A file that contains program code is called a ____________.
    13·1 answer
  • Is a way of grading web pages by the number of other web pages that link to them?
    10·1 answer
  • A network engineer is configuring a network to be able to relay IPv6 packets. The network only supports IPv4 and does not have d
    11·1 answer
  • Which of the following is the final fate for average sized stars?
    12·1 answer
  • Which of the following was one of the first internet search engines? A. archie B. google C. Yahoo D.ask
    7·1 answer
  • How can a wiki contribute to an academic paper?
    9·2 answers
  • Files with what two file extensions are commonly known as tarballs??
    8·1 answer
  • Neymar machine that Run on electricity
    11·1 answer
  • ABC IF U HAVE A LEGENDARY PET ON ADOPT ME OR ANYTHING COOL!! &lt;3
    5·2 answers
  • The computer components that enables a computer to send and receive data, instructions or information from one or more computers
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!