Menu

[Solved]Functions Load Filename Deck Function Load Cards File Format Shown Put Provided Deck Cards Q37039091

Python Please.

Functions load (filename, deck): This function will load cards from a file (in the format shown above) and put them in the

Disallowed things: * You may not import other modules (one import is given for you along with very specific instructions on h

Functions load (filename, deck): This function will “load” cards from a file (in the format shown above) and put them in the provided deck of cards (an array of dictionaries). Things you’ll need: . You need to open, read in, and close the file. Each line of the file is one string which represents a card. Use your knowledge of file I/O and/or string manipulation to break each line into its component parts * Take the component parts and make a card out of them Add the card to the deck provided (this function returns None, you must manipulate the deck given) Hints/Tips: We promise the files we give you are (and will be) in the correct format for all tests. However, if you write your own, make sure you’re following the format carefully! Remember to strip off the whitespace if you use readlines()! Go read the “allowed things” section for file I/O and strings.. make sure you know how each function mentioned works… there are some hints in what we’re allowing you to use For right now the only type of card you need to worry about is STR cards. tl;dr You’ll want to read this when you go to write the loadO function Disallowed things: * You may not import other modules (one import is given for you along with very specific instructions on how to use it). You may not use list comprehensions. Nothing not listed in the “Allowed things” section above may be used. For example, you may not use contains(), index), or try-except for this assignment o If you didn’t define it, you may not call it for this project! o Missing your favorite function? Consider implementing it as a “helper function'” Additional Requirements: Unless specified, your functions should not have any “side effects” (i.e. they may not impact variables declared outside the function). For example, dictionaries should not be changed when passed into your functions unless specified. Show transcribed image text Functions load (filename, deck): This function will “load” cards from a file (in the format shown above) and put them in the provided deck of cards (an array of dictionaries). Things you’ll need: . You need to open, read in, and close the file. Each line of the file is one string which represents a card. Use your knowledge of file I/O and/or string manipulation to break each line into its component parts * Take the component parts and make a card out of them Add the card to the deck provided (this function returns None, you must manipulate the deck given) Hints/Tips: We promise the files we give you are (and will be) in the correct format for all tests. However, if you write your own, make sure you’re following the format carefully! Remember to strip off the whitespace if you use readlines()! Go read the “allowed things” section for file I/O and strings.. make sure you know how each function mentioned works… there are some hints in what we’re allowing you to use For right now the only type of card you need to worry about is STR cards. tl;dr You’ll want to read this when you go to write the loadO function
Disallowed things: * You may not import other modules (one import is given for you along with very specific instructions on how to use it). You may not use list comprehensions. Nothing not listed in the “Allowed things” section above may be used. For example, you may not use contains(), index), or try-except for this assignment o If you didn’t define it, you may not call it for this project! o Missing your favorite function? Consider implementing it as a “helper function'” Additional Requirements: Unless specified, your functions should not have any “side effects” (i.e. they may not impact variables declared outside the function). For example, dictionaries should not be changed when passed into your functions unless specified.

Expert Answer


Answer to Functions load (filename, deck): This function will “load” cards from a file (in the format shown above) and put them in… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *