answer.
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
Lostsunrise [7]
2 years ago
15

Write a program that first reads in the name of an input file, followed by two strings representing the lower and upper bounds o

f a search range. The file should be read using the file.readlines() method. The input file contains a list of alphabetical, ten-letter strings, each on a separate line. Your program should output all strings from the list that are within that range (inclusive of the bounds).
Computers and Technology
2 answers:
inna [77]2 years ago
6 0

Answer:

filepath = 'Iliad.txt'

start = 'sometxtstart'

end = 'sometxtend'

apending = False

out = ""

with open(filepath) as fp:

   line = fp.readline()

   while line:

       txt = line.strip()

       if(txt == end):

           apending = False

       if(apending):

           out+=txt + '\n'

       if(txt == start):

           apending = True                

       line = fp.readline()

print(out)

xenn [34]2 years ago
3 0

Answer:

def func(filename, lower, upper):

   file = open(filename, 'r').readlines()

   for i in range(int(lower), int(upper)):

       print(file[i].rstrip())

func('strings','2','4')

Explanation:

file is provided below, name: strings in text format

appleelppa

banananana

cattaccatt

dogdogdogd

elephanttn

froggorffr

goattaoggo

horseesroh

illiterate

jumppmujju

You might be interested in
1. PGP encryption can be performed from the command line as well. What is the PGP command line syntax to encrypt the my-message.
bekas [8.4K]

Answer:

1. From the command prompt, type:

pgp --encrypt "my-message.txt" --recipient "Sean" --output "secret-message.txt.gpg"

2. Press Enter.

Explanation:

From the command line, the above command is entered and Enter is pressed.

The command start with pgp, then it has different options:

--encrypt: this specifies the input file to be encrypted

--recipient: this specifies the specific user to which the file is been encrypted

--output: this specifies the name to which the output (encrypted file) is saved.

8 0
2 years ago
Implement the function couple, which takes in two lists and returns a list that contains lists with i-th elements of two sequenc
In-s [12.5K]

Answer:

couple.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

s1=[1,2,3]

s2=[4,5,6]

print(couple(s1,s2))

enum.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

def enumerate(s,start=0):

  number_Array=[ i for i in range(start,start+len(s))]

  return couple(number_Array,s)

s=[6,1,'a']

print(enumerate(s))

print(enumerate('five',5))

Explanation:

7 0
2 years ago
Question 1:State the values of a, b, c, d and e after the following operations are carried out:
pychu [463]

Answer:

1.

a = 1

b = 20(int). 20,2857143(double)

c = 39

d = 7.6

e = 456

2.

x = 98

y = 99

z = 97

w = ca

print(x,y,z,w) -> 98 99 97 ca

3.

x = Please

y = walk on the gras

Pleasewalk on the gras

Explanation:

you can use IDE/Interpreter python to get clue number 3 and number 2

Sorry for bad English.

5 0
2 years ago
Write a program for determining if a year is a leap year. In the Gregorian calendar system you can check if it is a leaper if it
SOVA2 [1]

Answer:

def leap_year_check(year):

return if int(year) % 4 == 0 and (int(year) % 100 != 0 or int(year) % 400 == 0)

Explanation:

The function is named leap_year_check and takes in an argument which is the year which we wish to determine if it's a new year or not.

int ensures the argument is read as an integer and not a float.

The % obtains the value of the remainder after a division exercise. A remainder of 0 means number is divisible by the quotient and a remainder other wise means it is not divisible by the quotient.

If the conditions is met, that is, (the first condition is true and either the second or Third condition is true)

the function leap_year_check returns a boolean ; true and false if otherwise.

8 0
2 years ago
A laptop gets replaced if there's a hardware issue. Which stage of the hardware lifecycle does this scenario belong to?
Ilya [14]

Answer: Maintenance. This is the stage where software is updated and hardware issues are fixed if and when they occur. Retirement. In this final stage, hardware becomes unusable or no longer needed and it needs to be properly removed from the fleet

Explanation:

3 0
2 years ago
Other questions:
  • which of these paste options is commonly available from the paste options button? A> use the destination them. B. keep the em
    14·2 answers
  • An administrator has initiated the process of deploying changes from a sandbox to the production environment using the Force IDE
    5·1 answer
  • Create the strAnalysis() function that takes 1 string argument and returns a string message. The message will be an analysis of
    15·1 answer
  • A program is loaded into _________ while it is being processed on the computer and when the program is not running it is stored
    15·2 answers
  • Write a program that plays a reverse guessing game with the user. The user thinks of a number between 1 and 10, and the computer
    5·1 answer
  • Consider the following class declaration: public class Square { private double sideLength; public double getArea() { return side
    13·1 answer
  • Janice has a "jammed" key on her keyboard. Every time she strikes the "S" key it sticks and doesn't pop back. What should Janice
    6·2 answers
  • Doug grew up on a large farm in southwest Wisconsin. As a college graduation gift, Doug’s father gave him several hundred acres
    6·1 answer
  • What should businesses do in order to remain competitive under the current Cloud<br> landscape?
    6·2 answers
  • Select the described workplace culture from the drop-down menu.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!