You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
Carrying on from the previous exercise, now we will change the options so instead of reading the numbers from the command line, they are read from text files (one number per line), and keeping the optional parameter to accept weights also as a file.
reading data from files
Choose who in your team is sharing now! (pull the code from the previous exercise into your local repository) Hint: You need to add a new remote from your team member and pull their branch
Create a new branch from the branch used in the previous exercise.
Open the file squares.py. Make sure you can run it from a terminal with some input values!
Look at the part of the file that is using argparse
Modify the arguments so the data is read from a text file. Where the weights are still optional. The file should be runnable as python squares.py <file_numbers> --weights <file_weights> (where <...> should be replaced by the file of your choice).
Look at the working with data section to refresh how we read files in Python.
Modify the argparser arguments to receive file names instead of numbers.
Check the auto-generated help: python squares.py --help.
Check that you can run the file with the new form, whether you pass a weights file or not.
Share your solution as a pull request mentioning this issue (by including the text Addresses #142 in the pull request description), remember to mention your team members too! (with @github_username)
The text was updated successfully, but these errors were encountered:
Carrying on from the previous exercise, now we will change the options so instead of reading the numbers from the command line, they are read from text files (one number per line), and keeping the optional parameter to accept weights also as a file.
reading data from files
Hint: You need to add a new remote from your team member and pull their branch
squares.py
. Make sure you can run it from a terminal with some input values!argparse
weights
are still optional. The file should be runnable aspython squares.py <file_numbers> --weights <file_weights>
(where<...>
should be replaced by the file of your choice).argparser
arguments to receive file names instead of numbers.python squares.py --help
.Addresses #142
in the pull request description), remember to mention your team members too! (with@github_username
)The text was updated successfully, but these errors were encountered: