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
harkovskaia [24]
3 years ago
7

Define a Python function named file_listers with two parameters. The first parameter will be a string specifying the name of the

file to write to. The second parameter will be a list of str. Your function should open the file in a manner that erases its contents. For each entry in the second parameter, write it to the file and then a newline. Your function does not need to return anything.Example:list_2_file("empty.txt", []) creates a file named empty.txt but that file will be empty.list_2_file("simple.txt", ["Write", "me"]) creates a file named simple.txt which contains two lines of text. The first line has the text Write and the second line says me.
Computers and Technology
1 answer:
elena-14-01-66 [18.8K]3 years ago
5 0

Answer:

Check the explanation

Explanation:

we can now create a file named simple.txt which contains two lines of text

below is the solution to the question:

def file_listers(filename,strlist):

name=raw_input(filename)

file = open(file, 'w')

with file as ≠:

for i in range(0, len(strlist) ):

f.write(strlist[i]+"\n")

file. close();

You might be interested in
Verify (valid or not valid) using resolution the following reasoning: "Every student in the SCIS is a CS student or an IT studen
sveta [45]

Answer:

Please see the attached file for the complete answer.

Explanation:

Download pdf
8 0
3 years ago
Why are 90% of questions not being answered im scrolling through the questions. Most are not being answered except the easy ques
Anna [14]
I actually have this problem all the time. Rarely any of my questions get answered and I see this happening to other people all the time. It's crazy. 
5 0
3 years ago
Read 2 more answers
Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the int variable
levacccp [35]

Answer:

if (pH<7.0){

          neutral=0;

          base=0;

          acid=1;

      }

      else if (pH>7.0){

          neutral=0;

          base=1;

          acid=0;

      }

      else if (pH==7.0){

          neutral=1;

          base=0;

          acid=0;

      }

Explanation:

As required by the question, if and else statements have been used to test the value of the pH and assign the apropriate values to the variables neutral, base and acid.

The code snippet below can be used to prompt the user to enter values for pH

<em>import java.util.Scanner;</em>

<em>public class pHTest {</em>

<em>   public static void main(String[] args) {</em>

<em>      Scanner scr = new Scanner(System.in);</em>

<em>       System.out.println("Enter a value for the pH");</em>

<em>       int neutral, base, acid;</em>

<em>       double pH = scr.nextDouble();</em>

<em> if (pH<7.0){</em>

<em>           neutral=0;</em>

<em>           base=0;</em>

<em>           acid=1;</em>

<em>       }</em>

<em>       else if (pH>7.0){</em>

<em>           neutral=0;</em>

<em>           base=1;</em>

<em>           acid=0;</em>

<em>       }</em>

<em>       else if (pH==7.0){</em>

<em>           neutral=1;</em>

<em>           base=0;</em>

<em>           acid=0;</em>

<em>       }</em>

<em>} }</em>

4 0
4 years ago
Read 2 more answers
What is an entity supertype, and why is it used?
marissa [1.9K]

Answer:

Correct answer is option B (The reason for using supertypes is to minimize the number of nulls and to minimize the likelihood of redundant relationships)

Explanation:

Entity supertype

A  entity supertype is a generic entity type which is related with one or more subtypes.

Use of entity supertype:

The reason for using entity supertype is to reduce redundant relationships and it is also used to minimize the number of nulls.

5 0
3 years ago
Curved lines are generally used where blank is needed ( 1 point)
Andrews [41]
Form or volume probably. sorry, this question needs more info
7 0
3 years ago
Other questions:
  • Write the definition of a method named printPowerOfTwoStars that receives a non-negative integer n and prints a string consistin
    10·1 answer
  • What are strategies that you can use to yield web sites that are relevant to your research topic?
    13·1 answer
  • Ms Access is spreadsheet software.True or false​
    9·2 answers
  • What is the most important external issue when using social media in emergency management?
    6·1 answer
  • During prereading, it is not important to pay attention to visual aids.<br> T f
    15·2 answers
  • True/False: Audio menus can be useful when one's hands and eyes are busy, or to assist vision-impaired users. With audio menus,
    14·1 answer
  • Which type of element is , and what is the meaning of that element?
    8·1 answer
  • They have outlined their technical needs and have sent some of the documentation along with the potential provider's SLAs and te
    14·1 answer
  • Tommy loves taking care of homing pigeons. He sent a note to his crush who lives 24.0 km away from his house. These birds fly at
    9·1 answer
  • Tiền tệ ra đời là kết quả
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!