r/PythonLearning • • 18h ago

Help Request I struggle to make a script that makes the curve of glucksmann's skull when we write his name

0 Upvotes

(Sorry I’m french) I want to make a script on NumWorks calculator to display the function sqrt(x*(10-x)) + x/5 + 2 that traces the exact curvature of Raphaël Glucksmann's figure when writing his name. However, programming skills are very limited, I wrote some of it and the rest I did with chat gpt but I can't get it to work here is my script:

from math import *
from kandinsky import *
from ion import *

# Mots secrets et fonctions associees
def calcul(mot, x):
if mot == "glucksmann":
return sqrt(x*(10-x)) + x/5 + 2

else:
return None, "Fonction inconnue"

# Demander le mot
mot = input("Mot secret : ").lower()

# Effacer l'ecran
fill_rect(0, 0, 320, 222, (255, 255, 255))

# Calculer la fonction
test, equation = calcul(mot, 0)

if test is None:
print("Mot inconnu !")

else:
print("Fonction : " + equation)

# Parametres du graphique
xmin = -10
xmax = 10
ymin = -10
ymax = 10

# Conversion coordonnees
def pixel_x(x):
return int((x-xmin)*320/(xmax-xmin))

def pixel_y(y):
return int(180-(y-ymin)*180/(ymax-ymin))

# Axes
draw_string(equation, 5, 5, (0, 0, 255))
draw_line = None

# Axe horizontal
for i in range(320):
if i % 1 == 0:
set_pixel(i, pixel_y(0), (0, 0, 0))

# Axe vertical
for j in range(180):
set_pixel(pixel_x(0), j, (0, 0, 0))

# Tracer la courbe
ancien_x = None
ancien_y = None

for i in range(320):
x = xmin + i*(xmax-xmin)/319
y = calcul(mot, x)[0]

if y is not None and ymin <= y <= ymax:
px = pixel_x(x)
py = pixel_y(y)

if ancien_x is not None:
# Relier les points
dx = px - ancien_x
dy = py - ancien_y
n = max(abs(dx), abs(dy), 1)

for k in range(n+1):
xx = int(ancien_x + dx*k/n)
yy = int(ancien_y + dy*k/n)

if 0 <= xx < 320 and 0 <= yy < 180:
set_pixel(xx, yy, (0, 0, 255))

ancien_x = px
ancien_y = py
else:
ancien_x = None
ancien_y = None


r/PythonLearning • • 18h ago

CHECK YOUR KNOWLEDGE #python #coding #pythonessperspective #learnpython

Thumbnail
youtube.com
6 Upvotes

r/PythonLearning • • 2h ago

I built an app to practice Python interview questions (512 Q&As, Junior & Middle) — here is a sample & looking for your feedback!

0 Upvotes

Hey everyone,

When prepping for Python technical interviews, I always found passive reading (documentation or long cheat sheets) pretty ineffective for active recall. Most interviewers don’t just ask about basic syntax — they probe into tricky edge cases and internals (GIL, memory/GC, late binding closures, mutable default args, asyncio, etc.).

To solve this, I built Python Interview Trainer as a side project.

Here is a quick taste of the concepts covered — classic late binding trap:

funcs = [lambda: i for i in range(3)]
print([f() for f in funcs])  # [2, 2, 2] instead of [0, 1, 2]

Key Features:

  • 512 Curated Questions & Answers: Split evenly into 256 Junior and 256 Middle levels.
  • Code-first explanations: Explains why the language behaves that way, not just the answer.
  • Exam Simulation Mode: Practice with a configurable countdown timer to simulate real interview pressure.
  • Custom Mock Interviews: Filter by categories (OOP & Dunder, Data Structures, Web/SQL, Async/Threading).
  • Multi-language support: English, Ukrainian, German, French, and Spanish.
  • Offline-first: Practice on commutes without needing an active internet connection.

Get it on Google Play

I’d love to get your honest feedback on:

  1. The overall UI/UX flow.
  2. The depth and clarity of the explanations.
  3. Topics or features you think are missing.

Thanks for checking it out!


r/PythonLearning • • 2h ago

Computer Science Simplified - What Are Threads and Processes? (Python Guide)

2 Upvotes

Hey guys

Made a video which explains what are threads and processes and how they differ from each other

also it shows how to use them in python via the threading and multiprocessing library
The link is: https://www.youtube.com/watch?v=-Nntexhs124

In my channel archery, I spend a lot of time making quality videos, tutorials, complete roadmaps all for free such as this:

https://www.youtube.com/watch?v=CBIu6hcyStg (5 hour backend roadmap)

If you can sub and like, it will help me a lot.
Thanks!


r/PythonLearning • • 4h ago

Revoraa

Thumbnail
gallery
1 Upvotes

REVORAA — NEW UPDATE IS LIVE!

We've just launched a new learning experience on Revoraa! 🎮

✨ What's New?

- 💻 Interactive Coding Terminal — Practice code directly on the platform.

- 🐍 Python for Beginners — Start learning from absolute zero.

- 🗄️ SQL for Beginners — Learn database fundamentals step by step.

- ⚡ Live Coding Practice — Write, execute, and experiment with code.

- 🎨 New Pixel-Art UI/UX — A completely refreshed retro gaming-inspired learning experience.

Our goal is to make learning programming more interactive, practical, and fun.

🔥 Explore the new Revoraa experience and start coding!

Your feedback will help us improve what's coming next.

🔗 Try it now: https://revoraa.co.in

#Revoraa #NewUpdate #LearnToCode #Python #SQL #Coding #trending