{"id":22158393,"url":"https://github.com/andr3w03/python-argument-parser","last_synced_at":"2025-10-04T23:44:46.421Z","repository":{"id":110830011,"uuid":"522618608","full_name":"aNdr3W03/Python-Argument-Parser","owner":"aNdr3W03","description":"Basic Python Argument Parser Script","archived":false,"fork":false,"pushed_at":"2022-08-14T04:37:55.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T19:49:37.376Z","etag":null,"topics":["argument-parser","dicoding","practice","progamming","python"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aNdr3W03.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-08T16:04:35.000Z","updated_at":"2024-12-15T07:00:44.000Z","dependencies_parsed_at":"2023-04-18T15:17:05.009Z","dependency_job_id":null,"html_url":"https://github.com/aNdr3W03/Python-Argument-Parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aNdr3W03%2FPython-Argument-Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aNdr3W03%2FPython-Argument-Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aNdr3W03%2FPython-Argument-Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aNdr3W03%2FPython-Argument-Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aNdr3W03","download_url":"https://codeload.github.com/aNdr3W03/Python-Argument-Parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245294768,"owners_count":20591900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argument-parser","dicoding","practice","progamming","python"],"created_at":"2024-12-02T03:32:39.710Z","updated_at":"2025-10-04T23:44:46.363Z","avatar_url":"https://github.com/aNdr3W03.png","language":"Jupyter Notebook","readme":"# Python Argument Parser\n\nThis is an assignment practice for the Getting Started Programming with Python ([Memulai Pemrograman dengan Python](https://www.dicoding.com/academies/86 \"Memulai Pemrograman dengan Python - Dicoding\")) class, Popular Libraries in Python ([Library Populer pada Python](https://www.dicoding.com/academies/86/tutorials/5082 \"Library Populer pada Python - Memulai Pemrograman dengan Python\")) module, on the [Machine Learning Developer Learning Path](https://www.dicoding.com/learningpaths/30 \"Machine Learning Developer Learning Path at Dicoding Indonesia\") at [Dicoding Indonesia](https://www.dicoding.com \"Dicoding Indonesia\").\n\n## Script Description\n\nThe argument parser is useful when creating small program or script that can be directly receive parameter(s) when the program is run. Application program or script can be run via the CLI (Command-Line Interface) or Terminal or CMD (Command Prompt).\n\nWhen the program is run, it will aks for parameter `name` and `date of birth`. If the program is run without the parameters or only one parameter, then the program will return an error. The date of birth parameter format is `DD-MM-YYYY`. If the format of the date of birth parameter is incorrect, then the program will hanlde an exception (`ValueError`) which is checked in the `validDate` function.\n\nThe program will calculate the age that obtained from the date of birth parameter, so if the age is less than 30 years, then the output will display \"kakak\", otherwise the output will display \"bapak.\"\n\nYou can try this program by:\n\n\u003e 1. Make sure Python is installed on your local machine (`python --version`)  \n\u003e    If Python has not been installed, you can download it via this [link](https://www.python.org/downloads \"Python Download\")\n\u003e 2. Save or Download the Python file on local as `argParser.py` via this [**`link`**](https://github.com/aNdr3W03/Python-Argument-Parser/raw/main/argParser.py \"argParser.py\")\n\u003e 3. Run the file on `CLI` or `Terminal` or `CMD`\n\u003e 4. See the output example below if you need help\n\n## Output Example\n\n```powershell\nargParser.py -h\n```\n```powershell\nusage: argParser.py [-h] -n NAME -d DOB\n\noptions:\n  -h, --help            show this help message and exit\n  -n NAME, --name NAME  input your name\n  -d DOB, --dob DOB     input your date of birth (DD-MM-YYYY)\n```\n\n#\n\n```console\nargParser.py -n INPUTNAME -d INPUTDOB\n```\n```console\nINPUTNAME : input your name\nINPUTDOB  : input your date of birth (format: DD-MM-YYYY)\n```\n\n#\n\n```powershell\nargParser.py -n Andrew -d 20-01-2003\n```\n```powershell\nTerima kasih telah menggunakan argParser.py pada tahun 2022, kakak Andrew\n```\n\n#\n\n```powershell\nargParser.py -n Andrew -d 20-01-1990\n```\n```powershell\nTerima kasih telah menggunakan argParser.py pada tahun 2022, bapak Andrew\n```\n\n#\n\n```powershell\nargParser.py -n Andrew -d 2003-01-20\n```\n```powershell\nusage: argParser.py [-h] -n NAME -d DOB\nargParser.py: error: argument -d/--dob: ERROR, not a valid date: '2003-01-20'\n```\n\n#\n\n```powershell\nargParser.py -n Andrew\n```\n```powershell\nusage: argParser.py [-h] -n NAME -d DOB\nargParser.py: error: the following arguments are required: -d/--dob\n```\n\n#\n\n```powershell\nargParser.py -d 2003-01-20\n```\n```powershell\nusage: argParser.py [-h] -n NAME -d DOB\nargParser.py: error: the following arguments are required: -n/--name\n```\n\n#\n\n```powershell\nargParser.py\n```\n```powershell\nusage: argParser.py [-h] -n NAME -d DOB\nargParser.py: error: the following arguments are required: -n/--name, -d/--dob\n```\n\n## References\n\n[(Stack Overflow) Specify date format for Python argparse input arguments](https://stackoverflow.com/questions/25470844/specify-date-format-for-python-argparse-input-arguments)\n\n[(Stack Overflow) Python : extract parameters created with argparse](https://stackoverflow.com/questions/49311085/python-extract-parameters-created-with-argparse)\n\n[(Stack Overflow) Age from birthdate in python](https://stackoverflow.com/questions/2217488/age-from-birthdate-in-python)\n\n[(Stack Overflow) TypeError:'datetime.datetime' object is not subscriptable](https://stackoverflow.com/questions/11177293/typeerrordatetime-datetime-object-is-not-subscriptable)\n\n[(Programiz) Python strptime()](https://www.programiz.com/python-programming/datetime/strptime)\n\n[(Dicoding) Penanganan Pengecualian](https://www.dicoding.com/academies/86/tutorials/6421)\n\n[(Dicoding) Library Populer pada Python](https://www.dicoding.com/academies/86/tutorials/5082)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandr3w03%2Fpython-argument-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandr3w03%2Fpython-argument-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandr3w03%2Fpython-argument-parser/lists"}