Question

Write a function named "write_string" that takes no parameters and doesn't return a value. This function...

Write a function named "write_string" that takes no parameters and doesn't return a value. This function will write the string "hockey" to a file named "sacrifice.txt". If a named "sacrifice.txt" already exists it should be overwritten. (Python)

Can you help me?

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def write_string():
    f = open("sacrifice.txt", "w")
    f.write("hockey")
    f.close()




Please let me know if you have any doubts Please upvote this answer. Thanks!!

Add a comment
Know the answer?
Add Answer to:
Write a function named "write_string" that takes no parameters and doesn't return a value. This function...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT