{"id":16978930,"url":"https://github.com/dye784/pythondemo","last_synced_at":"2025-03-21T22:43:21.997Z","repository":{"id":83244113,"uuid":"85835603","full_name":"dye784/pythonDemo","owner":"dye784","description":null,"archived":false,"fork":false,"pushed_at":"2017-03-24T22:12:55.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-26T17:16:18.004Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dye784.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":"2017-03-22T14:10:31.000Z","updated_at":"2017-05-02T19:27:00.000Z","dependencies_parsed_at":"2023-03-01T06:30:27.590Z","dependency_job_id":null,"html_url":"https://github.com/dye784/pythonDemo","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/dye784%2FpythonDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dye784%2FpythonDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dye784%2FpythonDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dye784%2FpythonDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dye784","download_url":"https://codeload.github.com/dye784/pythonDemo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244880550,"owners_count":20525511,"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":[],"created_at":"2024-10-14T01:44:31.849Z","updated_at":"2025-03-21T22:43:21.972Z","avatar_url":"https://github.com/dye784.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning Python\n\n#### Printing in python\n```py\nprint 'Hello world'\n```\n\n#### Creating Variables\nPython uses underscores instead of camel case for variables\n```py\nmy_variable = 10\n```\n\n#### Booleans\nBooleans are capitalized. Operators are `and` `or` and `not`\n```py\nmy_bool = True\n```\n\n#### Functions\nFunctions are defines using `def`\n```py\ndef function_name():\n    print 'Hello'\n```\n\n#### Whitespace\nWhitespace is important in python to structure code. This is broken.\n```py\ndef spam():\neggs = 12\nreturn eggs\n\nprint spam()\n```\n\nto fix it you need to indent. Indentation should be 4 spaces\n```py\ndef spam():\n    eggs = 12\n    return eggs\n\nprint spam()\n```\n\n#### Comments\nTo comment out a single line we use the `#` sign. To comment out multiple lines we use triple single/double quotes `\"\"\"` and end it without another `\"\"\"`\n```py\n'''Some comment here'''\n```\n\n#### Math\nThe only new math operation we have is ** (exponentiation) compared to JavaScript.\n```py\neggs = 10 ** 2\n```\n\n#### Strings\nSame as JS. `\\` to escape. Concat is the same `+`.\n```py\n'There\\'s a snake in my boot!'\n```\nSome string methods :\n`len()`\n```py\nparrot = 'Norwegian Blue'\nprint len(parrot) #14 length of string\n```\n`String.lower()` and `String.upper()`\n```py\nparrot = 'Norwegian Blue'\nprint parrot.lower() #'norwegian blue' lower case opposite for upper\n```\n`str()`\n```py\npi = 3.14\nprint st(pi) #'3.14' as a string\n```\nNote: Methods that dot are methods only available to a specific data type. Methods that you envelop in parens apply to more than one data type.\n\nSimilar to template literals in JavaScript Python uses string formating with a %.\n```py\nstring_1 = \"Camelot\"\nstring_2 = \"place\"\n\nprint \"Let's not go to %s. 'Tis a silly %s.\" % (string_1, string_2) # Prints Let's not go to Camelot. 'Tis a silly place.\n```\nNote: you need the same number of `%s` as terms after the string aka after the `%` `(var1, var2, var3)`\n\n#### Conditionals \u0026 Control Flow\n```py\nanswer = \"Left\"\nif answer == \"Left\": # Colon after conditional statement\n    print \"This is the Verbal Abuse Room, you heap of parrot droppings!\"\nelif answer == \"Right\":\n    print \"Something else\"\nelse:\n    print \"Parrots...why...\"\n```\nComparators : `==`, `!=`, `\u003c`, `\u003e`, `\u003c=`, `\u003e=`\nBoolean Operators : `and`, `or`, `not`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdye784%2Fpythondemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdye784%2Fpythondemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdye784%2Fpythondemo/lists"}