From ca136eafbaba7fe5b7bda6b315dcabd5ae87c9f6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 26 Aug 2025 03:38:39 +0000 Subject: [PATCH] Add Python linting, update examples, and improve workflow configuration Co-authored-by: ndjcjsjcjsjsjc645 --- .github/workflows/blank.yml | 21 ++++++++++++-- Chapter I | 23 +++++++-------- Chapter III | 37 +++++++++++++------------ README.md | 12 +++++++- __pycache__/Chapter IIIcpython-313.pyc | Bin 0 -> 655 bytes __pycache__/Chapter Icpython-313.pyc | Bin 0 -> 504 bytes 6 files changed, 58 insertions(+), 35 deletions(-) create mode 100644 __pycache__/Chapter IIIcpython-313.pyc create mode 100644 __pycache__/Chapter Icpython-313.pyc diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 18a6a3e..620a039 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -25,12 +25,27 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - # Runs a single command using the runners shell - - name: Run a one-line script + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install tools + run: | + python -m pip install --upgrade pip + pip install ruff + + - name: Lint Python files with ruff + run: | + ruff --version + ruff check --output-format=github --exit-non-zero-on-fix . || true + + # Runs a one-line script using the runners shell + - name: Say hello run: echo Hello, world! # Runs a set of commands using the runners shell - - name: Run a multi-line script + - name: Next steps run: | echo Add other actions to build, echo test, and deploy your project. diff --git a/Chapter I b/Chapter I index 4480368..e476b87 100644 --- a/Chapter I +++ b/Chapter I @@ -1,22 +1,19 @@ -#Situation 1: -a = you -b = human -if a = b: +# Situation 1: +a = "you" +b = "human" +if a == b: print("a=b") print("You are loser") - # Situation 2: -a = you -b = human -if a ≠ b: - print("a≠b") +a = "you" +b = "human" +if a != b: + print("a!=b") print("You are animal loser") -''' - - + # Quiz -age = int(input("your age:")) +age = int(input("your age: ")) if age >= 0: print("You are loser!") diff --git a/Chapter III b/Chapter III index e7f4bd0..c0b34b0 100644 --- a/Chapter III +++ b/Chapter III @@ -1,18 +1,19 @@ ->>> import turtle as t #Import turtle pixel module ->>> t.forward(100) #Go forward 100 steps ->>> t.shape('turtle') #Set the shape of turtle as turtle appearance ->>> t.shape('arrow') ->>> t.right(90) #Take 90 degree right turn #draw a square: ->>> t.forward(100) #Go forward 100 steps,draw the second side ->>> t.right(90) ->>> t.forward(100) #Draw the third side ->>> t.right(90) ->>> t.forward(100) #Draw the fourth side ->>> t.speed("slow") ->>> t.circle(100) #Draw a circle with a radius of 100 with the current position as the center ->>> t.ht() #Hide the turtle ->>> t.isvisible() #Query the turtle display status -False ->>> t.st() #Display the turtle ->>> t.isvisible() #Query the turtle display status -True +import turtle as t + +t.shape("turtle") +t.speed("slow") + +# Draw a square +for _ in range(4): + t.forward(100) + t.right(90) + +# Draw a circle +t.circle(100) + +# Toggle visibility +t.ht() +t.st() + +# Keep the window open until clicked +t.exitonclick() diff --git a/README.md b/README.md index 4e51a8c..073d616 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ # Failureology -A curriculum about losers +A small collection of text files and simple Python exercises. + +## Run the Python examples +- Chapter I (console input): +``` +python3 "Chapter I" +``` +- Chapter III (turtle graphics): +``` +python3 "Chapter III" +``` diff --git a/__pycache__/Chapter IIIcpython-313.pyc b/__pycache__/Chapter IIIcpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cf00b8eaf6516f31e695c4c7a02a60ce366d3a73 GIT binary patch literal 655 zcmaix&r1S96vyA}FJ*PJG^C?=k)_B}w+O-xNz@^45yY}iy12PIyJE*!Eceu{KcYkb zO$V7SK__pD|3GilB?GB%xX6%CpSEC>#@GY#K>th1FqQ)v(ZjME%^aY(R(NG+P3T1tyh?# z8}NL&@3EHOv20qdplv`|p<1o-33)j-cg-RGT$SOa-tKMKBZlQW=Hui}4Eo(R9}|%8Ik_AZr*G!BV6zjeGISiABt0^91#I%LBa9*MUF@dUrc)a0s1dbAEIG!(Sse6Wbq!Zb4*X1{Dk6qd2(>n7y zHaE_Mdem~S{ic1wGm;d2THBFnh7m#^iWZ`YvLO>z2B>#1MKtvLxhas)9mD2K1)~3F v-1hU5F{HUM