{"id":19657839,"url":"https://github.com/gdatasoftwareag/pythonworkshoptbs1","last_synced_at":"2026-06-11T12:31:55.866Z","repository":{"id":89432481,"uuid":"171481285","full_name":"GDATASoftwareAG/PythonWorkshopTBS1","owner":"GDATASoftwareAG","description":"This is a small workshop for Python knowledge. It is designed to be a guided workshop.","archived":false,"fork":false,"pushed_at":"2019-02-19T13:46:06.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-27T02:30:16.359Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/GDATASoftwareAG.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":"2019-02-19T13:45:43.000Z","updated_at":"2023-09-07T15:20:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef69c754-8f29-4538-864c-51a795b1c7f7","html_url":"https://github.com/GDATASoftwareAG/PythonWorkshopTBS1","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GDATASoftwareAG/PythonWorkshopTBS1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GDATASoftwareAG%2FPythonWorkshopTBS1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GDATASoftwareAG%2FPythonWorkshopTBS1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GDATASoftwareAG%2FPythonWorkshopTBS1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GDATASoftwareAG%2FPythonWorkshopTBS1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GDATASoftwareAG","download_url":"https://codeload.github.com/GDATASoftwareAG/PythonWorkshopTBS1/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GDATASoftwareAG%2FPythonWorkshopTBS1/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34199516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-11T15:33:53.519Z","updated_at":"2026-06-11T12:31:55.846Z","avatar_url":"https://github.com/GDATASoftwareAG.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Workshop\n\nThis workshop should guide you through the basic things of Python3.\n\n## Order\n1. Variables\n2. Loops and conditionals\n3. Classes and Objects\n    1. Inheritance\n    2. Access-Rights\n4. Python-Console\n5. Main-Method\n6. Modules\n7. Frameworks\n    1. PyGame\n    2. Flask (Web Endpoint)\n    3. PyPlot\n8. Databases\n\n## Requirements\nTo follow all parts of this workshop you'll need the following things:\n* Python3\n* Pip3\n* Flask (installed with pip3)\n\n## 1. Variables\nTake a look into `variables.py` and make yourself familiar with the variable assignment.\n\nYou can run the `variables.py` by executing `python3 variables.py` inside a bash.\n\nThe console output should look like this:\n```\n12345\n3.1415\nhello\nhello\n[0, 1, 2]\n(0, 1, 2)\n\u003c_io.TextIOWrapper name='variables.py' mode='r' encoding='UTF-8'\u003e\n1\n1\n1\n2\n1\n1\n```\n\nTake a look into `global_variables.py` and make yourself familiar with the variable scopes of Python.\n\nConsole output:\n```\n2\n2\n4\ninner_function: 4\nouter_function: 4\n```\n\n## 2. Loops and conditionals\n### Conditionals\nTake a look into `conditionals.py` and make yourself familiar with the conditionals in Python.\n\nExecuting the script should show this console output:\n```\nNumber = 2.\nNumber = 2.\nBoolean is True.\nOnly the first boolean is True.\nOne of the booleans is True.\nStart evaluation. True or False.\nExecution of function_to_show_print_with_returned_boolean(boolean).\nFinished evaluation\nStart evaluation. False or True.\nExecution of function_to_show_print_with_returned_boolean(boolean).\nExecution of function_to_show_print_with_returned_boolean(boolean).\nFinished evaluation\nStart evaluation. False or False.\nExecution of function_to_show_print_with_returned_boolean(boolean).\nExecution of function_to_show_print_with_returned_boolean(boolean).\nFinished evaluation\nStart evaluation. True and False.\nExecution of function_to_show_print_with_returned_boolean(boolean).\nExecution of function_to_show_print_with_returned_boolean(boolean).\nFinished evaluation\nStart evaluation. False and True.\nExecution of function_to_show_print_with_returned_boolean(boolean).\nFinished evaluation\nStart evaluation. False and False.\nExecution of function_to_show_print_with_returned_boolean(boolean).\nFinished evaluation\nGreetings.\nNo world found.\nThis is the same statement as \"if simple_object != None:\"\nShould be the same\nNot the same object even when values in object are the same\nValues from objects are the same\n```\nYou can play a bit with the value of `number` to get into the `elif` and into the `else` condition if you want to.\n\n## Loops\nTake a look into `loops.py` and make yourself familiar with the loops in Python.\n\nRun the `loops.py` and compare the output with your understanding of the code.\n```\nValue of i is 0\nValue of i is 1\nValue of i is 2\nValue of i is 3\nValue of i is 4\n\t hello\n\t my\n\t name\n\t is\n\t John\nHello Peter\nHello Maria\nHello John\nNumber value 0\nNumber value 1\nNumber value 2\nNumber value 3\nNumber value 4\nNumber value 5\nNumber value 6\nNumber value 7\nNumber value 8\nNumber value 9\ncolors : red\ncolors : blue\ncolors : orange\ncolors : yellow\nanimals : cow\nanimals : tiger\nanimals : fish\nanimals : dog\nusername : admin\npassword : 1234\nurl : localhost:8080\nusername : admin\npassword : 1234\nurl : localhost:8080\n[2, 4]\n[1, 3]\n['a', 'b', 'c', 'aa', 'bb', 'cc', 'aaa', 'bbb', 'ccc', 'aaaa', 'bbbb', 'cccc']\n```\n\n## 3. Classes and objects\nTake a look into `classes.py` and make yourself familiar with classes in Python.\n\nTake a special look into the inheritance of those classes.\n\nEvery Person has a name and a surname.\n\nA Trainer is a Person with an extra attribute `amount_trainees` which should show the amount of trainees a trainer has.\n\nA Training has a location where the training will take place at, a trainer who will lead the training and some participants.\n\nA TrainingForTrainers is a Training at the location 'TBH1' with a specific topic.\n\nThe `get_information`-method will return the information of a TrainingForTrainers.\n\nConsole output of execution:\n```\nTopic: \"Python Crashkurs\"\nWhere: TBH1\nTrainer: Peter Schmidt\nAmount of participants: 3\nAmount of effected trainees: 12\n```\n\n## 4. Modules\nTake a look into `modules.py` and make yourself familiar with the way modules are being used in Python.\n\nModules can be installed by using a command line tool named `pip` which will download modules from the official\nPython module repository hosted on \"pypi.org\".\n\n## 5. Main-Method\nPython has, to our knowledge, a unique way of using the main method in a file. When a module is being imported the \n`__name__` identifier is being set to the name of the module being imported. For example if you would include the \n`classes` module being introduced in Chapter 3 via an `import` statement the `__name__` identifier would be set to\n`\"classes\"` (the literal string `classes`). \n\nHowever, if you call a module directly by executing it's python script file the `__name__` identifier will be set to \n`\"__main__\"` (again, the literal string `__main__`). \n\nIn most Python modules you will find the line `if __name__ == \"__main__\":` to distinguish between functionality\nand execution. Most python developers like this because it allows re-use of code for different purposes and enables\nmodules to contribute something useful when being imported.\n\nOne of the major use cases for this semantic is unit tests when we deal with utility modules.  \n\nFamiliarize yourself with `main.py` to see an example of this approach.  \n\n## 6. Python-Console\nThe Python console is launching a full python interpreter and executes each line being entered directly.\n\nThis can be used by the advanced Python magician(c) to solve easy tasks like enumerating files in a directory or \ncalculating hashes by the use of Pythons plenty utility modules. \n\nThe console can also be used to quickly verify that some method you are thinking about is working as expected.\nThis comes in handy when e.g. manipulating strings in real life applications. \n\n## 7. Frameworks\n\n### 1. PyGame (GUI Framework)\nTake a look into the `pygame_example.py`. You'll see a minimal example for a GUI application using PyGame.\n\nPyGame is using an event based model, as you can see in lines 16-26 in `pygame_example.py`. Pay close attention to how\nevents are being handled.\n\nPyGame has already implemented a lot of form and style attributes you would need in GUI applications, like buttons and \ntext boxes. Read [this german example](https://www.spieleprogrammierer.de/wiki/Pygame-Tutorial) which provides a good \noverview on what's possible with the Framework.\n\nDespite the name PyGame can be used to easily create any GUI application, not just games (although that is the focus of \nthe core module developers).\n\n### 2. Flask (Web Endpoint)\nTake a look at `flask_example.py`. You'll see a minimal example for a web-endpoint using Flask.\n\nIn `start_flask_app.sh` you can see how to start the web-application.\n```\n$ ./start_flask_app.sh \n * Serving Flask app \"flask_example.py\"\n * Environment: production\n   WARNING: Do not use the development server in a production environment.\n   Use a production WSGI server instead.\n * Debug mode: off\n * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\n```\nWhen visiting `http://127.0.0.1:5000/` with a browser you'll see the `Hello, World!`-string.\n\n### 3. MatPlotLib\nTake a look at `matplotlib_example.py`. You'll see some basic graphs that can be drawn using matplotlib's `pyplot`\npackage as well as some basic numpy examples. \n\n## 8. Databases\nIn general, Python supports a lot of databases by using different modules. `sqlite3_example.py` shows you a small \nexample of sqlite3 using the popular on-disk database framework.\n\nYou can also have a look at `mysql_example.py` and `odbc_example.py`, although both of those can not be demonstrated in\nthis workshop since we don't have local copies of MySQL and MS-SQL databases. However, both files will give you a \ngood idea how the modules used work.\n\n# Not enough?\nYou can easily do some online tutorials by yourself.\n[Here](https://medium.com/quick-code/top-tutorials-to-learn-python-programming-200a4283995f) is a page where you can find some nice tutorials which might help you.\n\nIf you want to build cool webapps using the Flask micro framework see [here](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world) for a complete tutorial.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgdatasoftwareag%2Fpythonworkshoptbs1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgdatasoftwareag%2Fpythonworkshoptbs1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgdatasoftwareag%2Fpythonworkshoptbs1/lists"}