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
lora16 [44]
3 years ago
9

Python program

Computers and Technology
1 answer:
Serhud [2]3 years ago
7 0

Answer:

The function in Python is as follows:

def search_file(filename,mystring):

my_dict = {}

count = 0

file = open(filename)

lines = file.readlines()

for line in lines:

 count+=1

 if mystring.lower() in line.lower():

  my_dict[count] = line.rstrip('\n')

return my_dict

Explanation:

This defines the function

def search_file(filename,mystring):

This initializes an empty dictionary

my_dict = {}

This initializes the number of lines to 0

count = 0

This opens the file

file = open(filename)

This reads the lines of the file

lines = file.readlines()

This iterates through the lines

for line in lines:

This increments the number line

 count+=1

This checks if the string exists in the line

 if mystring.lower() in line.lower():

If yes, the line number and the string are added to the dictionary

  my_dict[count] = line.rstrip('\n')

This returns the dictionary

return my_dict

You might be interested in
_______ are malicious programs that come into a computer system disguised as something else such as a free computer game or scre
Lady_Fox [76]

Answer:

Trojan horses

Explanation:

4 0
2 years ago
A data set includes data from 500 random tornadoes. The display from technology available below results from using the tornado l
EastWind [94]

Answer:

The answer is:

H_0:\mu=2.2\\H_1:\mu> 2.2

Explanation:

H_0:\mu=2.2\\H_1:\mu> 2.2

The test value of statistic t= \frac{\bar x-\mu}{\frac{s}{\sqrt{n}}}

                                               =\frac{2.31688-2.2}{0.206915}\\\\=0.56

The value of P = P(T>0.56)

                          =1-P(T<0.56)

                          =1-0.712

                          =0.288

  • Since the P value exceeds its mean value (0.288>0.05), the null assumption must not be rejected.  Don't ignore H0.
  • This assertion, it mean length of the tornado is greater than 2.2 miles also isn't backed by enough evidence.
6 0
3 years ago
3.5 Code Practice
Veseljchak [2.6K]

Answer:

grade = input("Enter grade")

def add(grade):

if grade == 9:

 print("Not in High School Freshman")

elif grade == 10:

 print("In High School")

 print("somophone")

elif grade == 11:

 print("in High School")

 print("Junior")

elif grade == 12:

 print("in High School")

 print("Senior")

else:

 print("Grade Not Accepted:")

return 0;

add(11)

Output:

Enter grade 11

in High School

Junior

Process finished with exit code 0

Explanation:

Firstly remember that this is a function, and not a program. Hence, you need to call the function to test it. A python program is interpreted line by line, Hence, we can test a function as well. Here we input a grade, and through the function find the details related to it and the print it out, which is clearly explained through the definition of the function.

7 0
4 years ago
Read 2 more answers
You will hear a series of activities typical of Candela's life. After listening to and repeating each one, rewrite the entire se
Anon25 [30]

These are the complete sentences using the correct forms of the verbs conjugated in the simple present tense:

  1. Nosotros escribimos correos electrónicos desde diferentes partes del mundo.
  2. Tus padres deben tener mucho dinero.
  3. Sus amigas asisten al gimnasio todos los días.
  4. Tú no comprendes a las otras abuelitas.
  5. Yo también vivo la vida loca.
<h3 /><h3>What is the simple present tense?</h3>

The Spanish simple present tense (''presente del indicativo'' in Spanish) is used to talk about habitual situations, routines, universal truths and facts.

All the verbs in the exercise are conjugated using this tense.

I was able to find the complete instructions for the exercise online. Here are the sentences that had to be changed:

  1. Candela escribe correos electrónicos desde diferentes partes del mundo. (Nosotros)
  2. Candela debe tener mucho dinero. (Tus padres)
  3. Candela asiste al gimnasio todos los días. (Sus amigas)
  4. Candela no comprende a las otras abuelitas. (Tú)
  5. Candela vive la vida loca. (Yo también)

Check more information about the simple present tense here brainly.com/question/26436711

6 0
3 years ago
I have an IPhone 8plus 64gb... should I get another phone like samsung note 9 or s9 ??
laiz [17]

Nah, I think the IPhone would be better than them both


7 0
3 years ago
Other questions:
  • You are asked to install a device that will combine several connections to the Internet and provide the sum of the available net
    8·2 answers
  • Emily wants to search online for cakes containing nuts. However, she wants to skip cakes that have raisins in them. Which option
    9·1 answer
  • Which is the correct formula to add the values in cells A1 and B1?
    11·2 answers
  • Why isn't my brainly camera working? I got Brainly Plus and can't even scan questions. I've logged out, I've uninstalled and rei
    14·1 answer
  • What is the name of the technology that is typically implemented on switches to avoid Ethernet connectivity problems when the wr
    11·1 answer
  • Rico is working on a document titled ‘Document1’. Which is most likely the case for Rico’s document?
    13·2 answers
  • Your program will read a word (or a whole line) from the user. It will then count the number of vowels in the word (or line) and
    12·1 answer
  • A normal HDMI signal has a colour depth of 8 bits per each of RGB colour. The maximum number
    13·1 answer
  • Why does atmospheric pressure does not effect on planes,jet planes and rocket?​
    9·1 answer
  • 1-List some applications appropriate for each of the display technologies: raster refresh systems,plasma panels, and LCDs.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!