Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Pylint

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
218 changes: 218 additions & 0 deletions Snippets_Importing_libraries.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/sandun9336/chatgpt-vscode/blob/main/Snippets_Importing_libraries.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "kDn_lVxg3Z2G"
},
"source": [
"# Importing a library that is not in Colaboratory\n",
"\n",
"To import a library that's not in Colaboratory by default, you can use `!pip install` or `!apt-get install`."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "GQ18Kd5F3uKe",
"outputId": "4439aee1-ef25-4918-a0db-b5860921f91d"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
"Requirement already satisfied: matplotlib-venn in /usr/local/lib/python3.10/dist-packages (0.11.9)\n",
"Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from matplotlib-venn) (3.7.1)\n",
"Requirement already satisfied: scipy in /usr/local/lib/python3.10/dist-packages (from matplotlib-venn) (1.10.1)\n",
"Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from matplotlib-venn) (1.22.4)\n",
"Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->matplotlib-venn) (1.0.7)\n",
"Requirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->matplotlib-venn) (8.4.0)\n",
"Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib->matplotlib-venn) (0.11.0)\n",
"Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib->matplotlib-venn) (2.8.2)\n",
"Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->matplotlib-venn) (23.1)\n",
"Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->matplotlib-venn) (3.0.9)\n",
"Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->matplotlib-venn) (1.4.4)\n",
"Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->matplotlib-venn) (4.39.3)\n",
"Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib->matplotlib-venn) (1.16.0)\n"
]
}
],
"source": [
"!pip install matplotlib-venn"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "__3eqm3q3sr-",
"outputId": "88d04c4a-822c-44cf-fa7f-ec51d875f5ff"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"E: Package 'libfluidsynth1' has no installation candidate\n"
]
}
],
"source": [
"!apt-get -qq install -y libfluidsynth1"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "apoRbfWsRZ7S"
},
"source": [
"# Install 7zip reader [libarchive](https://pypi.python.org/pypi/libarchive) "
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "d_j7nNbKRmhx",
"outputId": "0da3a8f3-7f5c-4806-8841-55dc1e7971fe"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
"Requirement already satisfied: libarchive in /usr/local/lib/python3.10/dist-packages (0.4.7)\n",
"Requirement already satisfied: nose in /usr/local/lib/python3.10/dist-packages (from libarchive) (1.3.7)\n"
]
}
],
"source": [
"# https://pypi.python.org/pypi/libarchive\n",
"!apt-get -qq install -y libarchive-dev && pip install -U libarchive\n",
"import libarchive"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "PeaSX9KXR58J"
},
"source": [
"# Install GraphViz & [PyDot](https://pypi.python.org/pypi/pydot)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "w9llCG2wSRDx",
"outputId": "ee1e2a51-53a4-4a02-c34a-70b8c4e26e2e"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
"Requirement already satisfied: pydot in /usr/local/lib/python3.10/dist-packages (1.4.2)\n",
"Requirement already satisfied: pyparsing>=2.1.4 in /usr/local/lib/python3.10/dist-packages (from pydot) (3.0.9)\n"
]
}
],
"source": [
"# https://pypi.python.org/pypi/pydot\n",
"!apt-get -qq install -y graphviz && pip install pydot\n",
"import pydot"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Tlh1MKxGrKFO"
},
"source": [
"# Install [cartopy](http://scitools.org.uk/cartopy/docs/latest/)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Zq68DSY2rP2W",
"outputId": "eacb6864-6a5d-415d-f616-1e8ec9e29b97"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
"Requirement already satisfied: cartopy in /usr/local/lib/python3.10/dist-packages (0.21.1)\n",
"Requirement already satisfied: shapely>=1.6.4 in /usr/local/lib/python3.10/dist-packages (from cartopy) (2.0.1)\n",
"Requirement already satisfied: numpy>=1.18 in /usr/local/lib/python3.10/dist-packages (from cartopy) (1.22.4)\n",
"Requirement already satisfied: pyproj>=3.0.0 in /usr/local/lib/python3.10/dist-packages (from cartopy) (3.5.0)\n",
"Requirement already satisfied: matplotlib>=3.1 in /usr/local/lib/python3.10/dist-packages (from cartopy) (3.7.1)\n",
"Requirement already satisfied: pyshp>=2.1 in /usr/local/lib/python3.10/dist-packages (from cartopy) (2.3.1)\n",
"Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1->cartopy) (23.1)\n",
"Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1->cartopy) (1.4.4)\n",
"Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1->cartopy) (2.8.2)\n",
"Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1->cartopy) (4.39.3)\n",
"Requirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1->cartopy) (8.4.0)\n",
"Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1->cartopy) (0.11.0)\n",
"Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1->cartopy) (1.0.7)\n",
"Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1->cartopy) (3.0.9)\n",
"Requirement already satisfied: certifi in /usr/local/lib/python3.10/dist-packages (from pyproj>=3.0.0->cartopy) (2022.12.7)\n",
"Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib>=3.1->cartopy) (1.16.0)\n"
]
}
],
"source": [
"!pip install cartopy\n",
"import cartopy"
]
}
],
"metadata": {
"colab": {
"name": "Snippets: Importing libraries",
"provenance": [],
"include_colab_link": true
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Binary file modified examples/create.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/explain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/refactor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions number_guesser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import random

def play_game():
"""Plays a number guessing game with the user."""
while True:
difficulty = input("Choose difficulty (type 'easy', 'medium', or 'hard'): ").lower()
if difficulty == 'easy':
max_number = 50
break
elif difficulty == 'medium':
max_number = 100
break
elif difficulty == 'hard':
max_number = 500
break
else:
print("Invalid difficulty. Please type 'easy', 'medium', or 'hard'.")

secret_number = random.randint(1, max_number)
num_guesses = 0
while True:
while True:
guess_str = input(f"Guess the number (between 1 and {max_number}): ")
try:
guess = int(guess_str)
except ValueError:
print("Invalid input! Please enter a whole number.")
continue

if guess < 1 or guess > max_number:
print(f"Your guess is out of range! Please enter a number between 1 and {max_number}.")
continue

# If input is valid and in range, break from this inner loop
break

num_guesses += 1 # Increment guesses only after a valid guess

if guess < secret_number:
print("Too low!")
elif guess > secret_number:
print("Too high!")
else:
print(f"Congratulations! You guessed it in {num_guesses} tries.")
break

if __name__ == "__main__":
while True:
play_game()
while True:
play_again_response = input("Do you want to play another round? (yes/no): ").lower()
if play_again_response == "yes":
break # Breaks the inner loop, continues the outer loop to play again
elif play_again_response == "no":
print("Thanks for playing!")
exit() # Exits the script
else:
print("Invalid input. Please type 'yes' or 'no'.")
Binary file modified resources/extensionIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.