Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

29022021 OSCI GOS Assignment Assignment 5 Goals The goal of this assignment is to work with scripts and packages in Python Instructions You will be

image text in transcribedimage text in transcribedimage text in transcribed

29022021 OSCI GOS Assignment Assignment 5 Goals The goal of this assignment is to work with scripts and packages in Python Instructions You will be doing your work in Python for this assignment You may choose to work on this assignment on a hosted environment (e.g. tiger) or on your own local installation of Jupyter and Python. You should use Python 3.8 or higher for your work. To use tiger, use the credentials you received. If you work remotely, make sure to download the py files to turn in. If you choose to work locally. Anaconda is the easiest way to install and manage Python. If you work locally, you may launch Jupyter Lab either from the Navigator application or via the command line as jupyter-lab. In this assignment, we will again be working with data from Pokmon compiled from online sources. As with Assignment 3. we will be using the Complete Pokemon Dataset collected by Mario Tormo Romero from online sources. Rather than using this dataset directly, 1 have created a subset of this data, which can be read into a list of dictionaries. That data is located here it is updated from Assignment 3 with the addition of sp_attack and sp_detense so download the new one. Once loaded the data is a list of dictionaries where each dictionary has 12 key-value pairs. Those keys and a brief description are: . nanethe name generation: the generation (1-8) Species: the species (e.g. Lizard Pokmon) primary type: the primary type le.g. Grass, Fire) hop: base hit points height n; height in meters weight_kg: weight in kilograrns speed: base speed attack: base attack defense: base defense sp_attack: special attack sp_defense: special defense You will be writing Python modules, putting them in a package, and writing a script to help analyze this data. You may use other core Python modules (eg, collections) this assignment Due Date The assignment is due at 11:59pm on Friday, March 5. Submission You should submit the completed Python files required for this assignment on Blackboard, Zip the files together, the filename of the zipfile should be as.zip. You can create an archive on tiger (assurning at a directory above the package) using the following code: import shutil shutil nake_archive('a', 'zip', ''pokemon analysis') Then, download the a5 zip to turn in via Blackboard. Details Please make sure to follow instructions to receive full credit. To test your code, you may use the Xrun magic command in the notebook. For example, Xrun pokemon.py run - pokenon_analysis You may also use the Terminal in Jupyter on tiger, but you should activate the correct environment by first running: $ conda activate py38 0. Name & Z-ID (5 pts) Since we are using Python tiles (py) files for this assignment, add the identifying information to the beginning of your_main.py script and the __init__.py file of your package. Minimally, you should have a line for your name and a line for your ZID. If you wish to add other information (the assignment name, a description of the assignment), you may do so after these two lines, Ass. C. di ko piss-200 SPRIGOMS. 143 20022021 CSCI 603 Aglorment 1. Pokmon Analysis Package (50 pts) Create three new Python modules, one for reading the cataset, one for analyzing generations, and one for comparing two Pokmon characters. Put the three modules (data.py, generation.py, and compare.py) into a package named pokemon_analysis. 1a. Read Data (10 pts) Create a data,py module that has a get data method that reads and parses the pokemon.json datatile, and stores it in a module variable. Assume that the data file resides in the same directory as data,py. You can then ge its absolute path via the_file_variable of the module via: import os fnane - Ds.path.join(as.path.dirname(_file_), 'pukemon.json) Use the json module to load the data from the file. Your get_data method should only read the file from disk once, otherwise returning the pre-loaded data Hints Initialize the module variable to a sentinel value to indicate when the data has not been read. You can use Sautoreload to automatically reload modules as you edit them. Do note, however, that this will mask the effects of trying to not keep reloading the data! You can also use importlib.reload to do this manually. 1b. Generation Analysis (15 pts) Create a generation.py module that has two methods that both take one parameter, the generation number. Use the yet_data method from the data module to obtain the data. The first method, generation types, should retum a dictionary of the form {} with the counts of primary types for the given generation. The second methodi, generation_ranges, should return a dictionary of the form (cmeasure>: ] Xrun - f pokemon_analysis generation Isage: python-m pokemon_analysis (eeneration chur compare crame1> >] Arun pokemon_analysis generation 3 Generation 3 hp: 1.2-170.0 attack: 15.-190.e defense: 20.0-230.0 run - n pokenon analysis compare Mewtwo Magikarp Mewtwo has +3882.649695 combat power than Magikarp Kruni - pokemon analysis compare Mewtwo Slaking Mewtwo has -227.23a9e9 combat power than Slaking Hints Create a usage method that can be called whenever there is trouble You will need a different number of arguments depending on which subcommand is called . Look at the format language to display + or - appropriately for the compare subcommand Extra Credit Extend the main script to allow use of the other functions in the modules. Extend the compare code and the script to take an arbitrary number (>= 2) of Pokemon as arguments, A. Candkarpia 2007 marts 29022021 OSCI GOS Assignment Assignment 5 Goals The goal of this assignment is to work with scripts and packages in Python Instructions You will be doing your work in Python for this assignment You may choose to work on this assignment on a hosted environment (e.g. tiger) or on your own local installation of Jupyter and Python. You should use Python 3.8 or higher for your work. To use tiger, use the credentials you received. If you work remotely, make sure to download the py files to turn in. If you choose to work locally. Anaconda is the easiest way to install and manage Python. If you work locally, you may launch Jupyter Lab either from the Navigator application or via the command line as jupyter-lab. In this assignment, we will again be working with data from Pokmon compiled from online sources. As with Assignment 3. we will be using the Complete Pokemon Dataset collected by Mario Tormo Romero from online sources. Rather than using this dataset directly, 1 have created a subset of this data, which can be read into a list of dictionaries. That data is located here it is updated from Assignment 3 with the addition of sp_attack and sp_detense so download the new one. Once loaded the data is a list of dictionaries where each dictionary has 12 key-value pairs. Those keys and a brief description are: . nanethe name generation: the generation (1-8) Species: the species (e.g. Lizard Pokmon) primary type: the primary type le.g. Grass, Fire) hop: base hit points height n; height in meters weight_kg: weight in kilograrns speed: base speed attack: base attack defense: base defense sp_attack: special attack sp_defense: special defense You will be writing Python modules, putting them in a package, and writing a script to help analyze this data. You may use other core Python modules (eg, collections) this assignment Due Date The assignment is due at 11:59pm on Friday, March 5. Submission You should submit the completed Python files required for this assignment on Blackboard, Zip the files together, the filename of the zipfile should be as.zip. You can create an archive on tiger (assurning at a directory above the package) using the following code: import shutil shutil nake_archive('a', 'zip', ''pokemon analysis') Then, download the a5 zip to turn in via Blackboard. Details Please make sure to follow instructions to receive full credit. To test your code, you may use the Xrun magic command in the notebook. For example, Xrun pokemon.py run - pokenon_analysis You may also use the Terminal in Jupyter on tiger, but you should activate the correct environment by first running: $ conda activate py38 0. Name & Z-ID (5 pts) Since we are using Python tiles (py) files for this assignment, add the identifying information to the beginning of your_main.py script and the __init__.py file of your package. Minimally, you should have a line for your name and a line for your ZID. If you wish to add other information (the assignment name, a description of the assignment), you may do so after these two lines, Ass. C. di ko piss-200 SPRIGOMS. 143 20022021 CSCI 603 Aglorment 1. Pokmon Analysis Package (50 pts) Create three new Python modules, one for reading the cataset, one for analyzing generations, and one for comparing two Pokmon characters. Put the three modules (data.py, generation.py, and compare.py) into a package named pokemon_analysis. 1a. Read Data (10 pts) Create a data,py module that has a get data method that reads and parses the pokemon.json datatile, and stores it in a module variable. Assume that the data file resides in the same directory as data,py. You can then ge its absolute path via the_file_variable of the module via: import os fnane - Ds.path.join(as.path.dirname(_file_), 'pukemon.json) Use the json module to load the data from the file. Your get_data method should only read the file from disk once, otherwise returning the pre-loaded data Hints Initialize the module variable to a sentinel value to indicate when the data has not been read. You can use Sautoreload to automatically reload modules as you edit them. Do note, however, that this will mask the effects of trying to not keep reloading the data! You can also use importlib.reload to do this manually. 1b. Generation Analysis (15 pts) Create a generation.py module that has two methods that both take one parameter, the generation number. Use the yet_data method from the data module to obtain the data. The first method, generation types, should retum a dictionary of the form {} with the counts of primary types for the given generation. The second methodi, generation_ranges, should return a dictionary of the form (cmeasure>: ] Xrun - f pokemon_analysis generation Isage: python-m pokemon_analysis (eeneration chur compare crame1> >] Arun pokemon_analysis generation 3 Generation 3 hp: 1.2-170.0 attack: 15.-190.e defense: 20.0-230.0 run - n pokenon analysis compare Mewtwo Magikarp Mewtwo has +3882.649695 combat power than Magikarp Kruni - pokemon analysis compare Mewtwo Slaking Mewtwo has -227.23a9e9 combat power than Slaking Hints Create a usage method that can be called whenever there is trouble You will need a different number of arguments depending on which subcommand is called . Look at the format language to display + or - appropriately for the compare subcommand Extra Credit Extend the main script to allow use of the other functions in the modules. Extend the compare code and the script to take an arbitrary number (>= 2) of Pokemon as arguments, A. Candkarpia 2007 marts

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago