Question: PYTHON 1 . Create a function called store ( filename ) . The function should do the following: a . Read the data from the

PYTHON
1. Create a function called store(filename). The function should do the following:
a. Read the data from the filename specified in its parameter. The data in the file has three parts: height, growth rate and DNA sequence.
b. Split the data into the above mentioned three parts and store them in a list.
c. Return the list.
2. Create a function called main(). This function should do the following:
a. Prompt the user for a filename. For testing purposes, we have provided the files dna1.txt, dna2.txt and dna3.txt here.
b. Add the following code to your main function to test the store function:
info = store(filename)
height = info[0]
growth_rate = info[1]
raw_dna = info[2]
print(f"HEIGHT: {height} GROWTH RATE: {growth_rate}
RAW DNA: {raw_dna[:30]}...") What to do
1. Create a function called store(filename). The function should do the following:
a. Read the data from the filename specified in its parameter. The data in the file has three parts: height, growth rate and DNA sequence.
b. Split the data into the above mentioned three parts and store them in a list.
c. Return the list.
2. Create a function called main(). This function should do the following:
a. Prompt the user for a filename. For testing purposes, we have provided the files dna1.txt, dna2.txt and dna3.txt here.
b. Add the following code to your main function to test the store function:
```
info = store(filename)
height = info[0]
growth_rate = info[1]
raw_dna = info[2]
print(f"HEIGHT: {height} GROWTH RATE: {growth_rate}
RAll DNA: {raw_dna[:30]}...")
```
PYTHON 1 . Create a function called store (

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!