r/learnpython 1d ago

Looking for a testing software

6 Upvotes

I'm teaching an introductory python course for high school students and I'm looking for a way to test them. I'm looking for a compiler-like platform where they can see the questions and code them and submit the answers to me.

Preferably it would include an auto grader with test cases.

Preferably it should have lockdown/anti-cheat mode.

They will use the computer labs we have and not their own computers so Preferably it should be a website not an app so they can just open it directly.

My goal is that they code in a compiler instead of on paper because they hated it last exam so any suggestion on how to do that is welcome.


r/learnpython 1d ago

Proper etiquette for uploading projects to git?

5 Upvotes

I'm not sure if this is the best place to ask this.. I can move somewhere better if needed.

I've been learning python off and on for a couple years now, and recently started taking the PY4E class. I'm most of the way through it and really loving it.

Anyway the problem I'm running into is, I've never really used my GitHub before. Late last night I started playing around of how to push my projects I've completed into repos, and I was wondering what the proper etiquette for doing so.

For example I was uploading to GitHub each small project at a time, each one had there own repo, but I got to thinking last night if it would be better to upload entire chapters in one repo based on how pushing projects works in VS Code.

I've been working on a few other projects on the side as well and wanted to know how that environment works before I spend a ton of time doing it the wrong way.

Any recommendations are greatly appreciated! Sorry again if this is the wrong place to ask.


r/learnpython 1d ago

Failed to build wheel for mayavi

1 Upvotes

So I need to import mayavi for a long reason, and every time I try to import it, it says

Current thread's C stack trace (most recent call first):
        <cannot get C stack on this system>
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mayavi
Failed to build mayavi
error: failed-wheel-build-for-install

I already installed VTK and PyQt5 with no issue using pip and tried both with and without PyQt5 (since on the website they install it after installing mayavi). I'm currently on a windows x64 and using visual studio code

If anyone knows anything about this I'd appreciate any advice ;u;


r/learnpython 1d ago

Best Free Websites to Practice Python and Get Feedback

2 Upvotes

Hello everyone!

I'm currently a college student (20) who started learning Python this summer about a month and a half ago. So far, I've been watching a YouTube video and using W3 Schools to teach me the concepts.

I've also been using ChatGPT as a coach to help me practice, and although it does a pretty good job, I mostly prefer to have help from an actual person or website, not just AI.

What are your top recommendations?


r/learnpython 2d ago

I started Python about a month ago,my progress so far!!(read desc)

8 Upvotes

I think I have pretty good hang of python basics what else should I do?

Please check out my github and say what I should improve

Some people are saying file io some are saying Oops idk what to do

Github: https://github.com/ThunderrZYN/My-PYTHON-grind-so-far-1-month-.git


r/learnpython 2d ago

Starting Learning Python at 15!

8 Upvotes

My brother and I have both had a shared interest in the technological world and our father is heavily involved with it. When we were younger he tried to persuade us to give coding a go but alas niether one of us was keen on coding back the, however now we are both trying to learn so any tips ,comments, help or advice would be greatly aprreciated!!!


r/learnpython 1d ago

a low ram ui module for python (except tkinker)

1 Upvotes

i have used python for a while now but i am unable to make afew projects just because it needs ui and i dont want tkinker tbh i want more plain modern(like half of discord) look is there any python module with similar concept with low ram usage(comparatively)
note- i tried tkinker and it is soo limiting for me


r/learnpython 2d ago

Starting Python again for ML/AI. How should I study it effectively?

0 Upvotes

Hi everyone,

I'm starting to learn Python again after taking a long break. I studied it before, but I didn't use it much, so I forgot a lot of things. Every time I come back to Python, I feel like I'm starting from scratch again.

My long-term goal is to use Python for machine learning, deep learning, and AI. However, I'm not sure what the most effective learning path is.

Should I focus on mastering Python fundamentals first, or should I start building small ML projects as soon as possible? Also, how can I remember what I learn instead of forgetting it after a few weeks?

If you've been in a similar situation, I'd really appreciate your advice or any resources that helped you.

Thanks in advance!


r/learnpython 2d ago

Camera + python

6 Upvotes

Hi everyone, when I hear python the first thing that comes to my mind is programs that detect body movement and position (like a workout) with a camera or a program that counts how many red cars passed by... Etc, I don't know exactly what this field is called but I want to learn it and use it, so if anyone knows what I am thinking about, I Will be more than grateful to know what to look for or any learning source/recommendations (yt tutorial/ free courses or even books if helpful)


r/learnpython 2d ago

Problem with an extra row in Excel on Python

0 Upvotes

I have a Python table, but there are extra cells at the top when I output it; I’d like to remove them—how can I do that?

Using Openpyxl.


r/learnpython 2d ago

TypeError: array([2, 5, 7]) is not a callable object. What to do?

0 Upvotes

I am trying to learn Python by completing a tutorial, specifically I am trying to make a Gaussian function. I tried to search it up on the internet and on one website, they advised to change the name of the variable but it didn't change the error. It is still there. Please help, what do I do? This is the website that I've used to try to make my Gaussian function: https://education.molssi.org/python-data-analysis/03-data-fitting/index.html

Here's my code below:

z = [2,5,7]

y = [9,0,-1]

z = np.asarray(z)

y = np.asarray(y)

def Gauss (z,A, B):

y = A*np.exp(-1*B*x**2)

return y

parameters, covariance = curve_fit(x, y, Gauss)

fit_A = parameters[2]

fit_B = parameters[0]

fit_y = Gauss(z, fit_A, fit_B)

plt.scatter(z, y, label = 'Gauss')

plt.scatter(z, fit_y, color = 'lightcoral')

plt.legend()

And this is the error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[71], line 8
      4 
      5 
def
 Gauss (z,A, B):
      6     y = A*np.exp(-1*B*x**2)
      7     
return
 y
----> 8 parameters, covariance = curve_fit(x, y, Gauss)
      9 fit_A = parameters[2]
     10 fit_B = parameters[0]
     11 fit_y = Gauss(z, fit_A, fit_B)

File /Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/site-packages/scipy/optimize/_minpack_py.py:907, in curve_fit(f, xdata, ydata, p0, sigma, absolute_sigma, check_finite, bounds, method, jac, full_output, nan_policy, **kwargs)
    594 """
    595 Use non-linear least squares to fit a function, f, to data.
    596 
   (...)    903 array([5.00000000e+05, 1.00000000e-02, 1.49999999e+01])
    904 """
    905 
if
 p0 
is

None
:
    906     # determine number of parameters by inspecting the function
--> 907     sig = _getfullargspec(f)
    908     args = sig.args
    909     
if
 len(args) < 2:

File /Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/site-packages/scipy/_lib/_util.py:487, in getfullargspec_no_self(func)
    466 
def
 getfullargspec_no_self(func):
    467     """inspect.getfullargspec replacement using inspect.signature.
    468 
    469     If func is a bound method, do not list the 'self' parameter.
   (...)    485 
    486     """
--> 487     sig = wrapped_inspect_signature(func)
    488     args = [
    489         p.name 
for
 p 
in
 sig.parameters.values()
    490         
if
 p.kind 
in
 [inspect.Parameter.POSITIONAL_OR_KEYWORD,
    491                       inspect.Parameter.POSITIONAL_ONLY]
    492     ]
    493     varargs = [
    494         p.name 
for
 p 
in
 sig.parameters.values()
    495         
if
 p.kind == inspect.Parameter.VAR_POSITIONAL
    496     ]

File /Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/site-packages/scipy/_lib/_util.py:44, in wrapped_inspect_signature(callable)
     42 
def
 wrapped_inspect_signature(callable):
     43     """Get a signature object for the passed callable."""
---> 44     
return
 inspect.signature(callable,
     45                              annotation_format=annotationlib.Format.FORWARDREF)

File /Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/inspect.py:3323, in signature(obj, follow_wrapped, globals, locals, eval_str, annotation_format)
   3320 
def
 signature(obj, *, follow_wrapped=
True
, globals=
None
, locals=
None
, eval_str=
False
,
   3321               annotation_format=Format.VALUE):
   3322     """Get a signature object for the passed callable."""
-> 3323     
return
 Signature.from_callable(obj, follow_wrapped=follow_wrapped,
   3324                                    globals=globals, locals=locals, eval_str=eval_str,
   3325                                    annotation_format=annotation_format)

File /Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/inspect.py:3038, in Signature.from_callable(cls, obj, follow_wrapped, globals, locals, eval_str, annotation_format)
   3033 u/classmethod
   3034 
def
 from_callable(cls, obj, *,
   3035                   follow_wrapped=
True
, globals=
None
, locals=
None
, eval_str=
False
,
   3036                   annotation_format=Format.VALUE):
   3037     """Constructs Signature for the given callable object."""
-> 3038     
return
 _signature_from_callable(obj, sigcls=cls,
   3039                                     follow_wrapper_chains=follow_wrapped,
   3040                                     globals=globals, locals=locals, eval_str=eval_str,
   3041                                     annotation_format=annotation_format)

File /Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/inspect.py:2436, in _signature_from_callable(obj, follow_wrapper_chains, skip_bound_arg, globals, locals, eval_str, sigcls, annotation_format)
   2426 _get_signature_of = functools.partial(_signature_from_callable,
   2427                             follow_wrapper_chains=follow_wrapper_chains,
   2428                             skip_bound_arg=skip_bound_arg,
   (...)   2432                             eval_str=eval_str,
   2433                             annotation_format=annotation_format)
   2435 
if

not
 callable(obj):
-> 2436     
raise

TypeError
('
{!r}
 is not a callable object'.format(obj))
   2438 
if
 isinstance(obj, types.MethodType):
   2439     # In this case we skip the first parameter of the underlying
   2440     # function (usually `self` or `cls`).
   2441     sig = _get_signature_of(obj.__func__)

TypeError: array([2, 5, 7]) is not a callable object

r/learnpython 2d ago

Infosys Python virtual coding assessment coming up — any tips or resources?

0 Upvotes

Hey everyone, I have an Infosys virtual coding assessment (Python) coming up and want to prepare well. If anyone has information, experience, or resources to share, it'd help a lot:

  • What kind of questions usually show up — basic programming logic, DSA, or scenario-based problems?
  • Roughly how many questions and what's the time limit like?
  • Common topics to focus on (loops, strings, recursion, OOP, etc.)?
  • Any good practice platforms or resources for this specific test?
  • Any general tips for doing well in it?

Appreciate any help — thanks!


r/learnpython 2d ago

How to approach learning

10 Upvotes

I have completed all of this and I went on trying to recreate the fourier series by younes lab from youtube by myself I struggled a lot and wasn't able to understand most of is it normal I want to learn python based on scientific computation and simulation I don't understand how to approach any resources or help would be very much appreciated is using AI to understand stuff bad also should I try automate the boring even though it is not related to scientific computation would it help


r/learnpython 2d ago

Help with Excel cells in Python

8 Upvotes

Could you please advise me on exactly what I should study to be able to open two or more Excel files and select specific cells? For instance, I want to take cells A2 through B2 from the first file, while C2 in Python will be the result of A2 multiplied by B2. Here is the key point to understand: in Python, I want to treat the Excel cell D2 as D1 (because of the offset in Excel); essentially, I want to continue working with that first file but map the Excel column C2 to position D1 in Python, and do the same for the second file. I know I’ll need to create a list, but right now it’s hard for me to even articulate the idea clearly. Thanks everyone for your attention!

Here is my code; ideally, I’d like something created based on it.

Please also let me know if you have any issues with the code.

import pandas as pd

from pandastable import Table, TableModel

import tkinter as tk

from tkinter import ttk
from tkinter import filedialog,messagebox

fd = filedialog

class ExcelViewer:
    def __init__(self, root):
        self.root = root
        self.root.title = ("Чтение ячеек Excel")
        self.root.geometry("800x600")

        self.btn_load = tk.Button(root, text="Открыть Excel файл", command=self.open_file)
        self.btn_load.pack()

        self.result_label = tk.Label(root, text="Выбрать файл для начала")
        self.result_label.pack()

        self.frame = tk.Frame(root)
        self.frame.pack(fill='both', expand=True)

        self.table = None

        self.scrollbar = ttk.Scrollbar(root)
        self.scrollbar.pack(side=tk.RIGHT, fill=tk.Y)


    def open_file(self):
        file_path = fd.askopenfilenames(
            filetypes=[
                (
                    'Excel файлы',
                    '*.xlsx'
                )
            ]
        )

        if not file_path:
            return

        if file_path:
            try:
                df = pd.read_excel(file_path)

                if self.table:
                    self.table.destroy()

                self.model = TableModel()
                self.model.df = df
                self.table = Table(self.frame, model = self.model, showtoolbar=False, showstatusbar=False)
                self.table.show()

            except Exception as e:
                tk.messagebox.showerror("Ошибка", f"Не удалось открыть файл:\n{e}")

if __name__ == "__main__":
    root = tk.Tk()
    app = ExcelViewer(root)
    root.mainloop()

r/learnpython 2d ago

Image detection without ocr for a gaming project

1 Upvotes

Hello i'm in the midsts of trying to automate relic exportation for the game warframe so me and my friends can figure out what we can grind for

ok so there is text always in the same 20 regions that swaps out as you scroll i've attempted to use ocr but i think the background colour and the image being behind parts of the text screws with that so i'm attempting image tagging to manually match my issue is on upgraded relics they get an addition tag so not only am i struggling to conceptualize how i should tag but also how to setup tagging does anyone have any tips?


r/learnpython 2d ago

Problem opening an XLSX (Excel) file

4 Upvotes
I have the following code, and I don't understand why I'm getting an error and can't open the file. The error is: "Invalid file path or buffer object type: <class 'tuple'>".
Could you please help?
Thanks everyone.
P.S. If there are any issues with the code, please let me know.



import pandas as pd

from pandastable import Table, TableModel

import tkinter as tk

from tkinter import ttk
from tkinter import filedialog,messagebox

fd = filedialog

class ExcelViewer:
    def __init__(self, root):
        self.root = root
        self.root.title = ("Чтение ячеек Excel")
        self.root.geometry("800x600")

        self.btn_load = tk.Button(root, text="Открыть Excel файл", command=self.open_file)
        self.btn_load.pack()

        self.result_label = tk.Label(root, text="Выбрать файл для начала")
        self.result_label.pack()

        self.frame = tk.Frame(root)
        self.frame.pack(fill='both', expand=True)

        self.table = None

        self.scrollbar = ttk.Scrollbar(root)
        self.scrollbar.pack(side=tk.RIGHT, fill=tk.Y)


    def open_file(self):
        file_path = fd.askopenfilenames(
            filetypes=[
                (
                    'Excel файлы',
                    '*.xlsx'
                )
            ]
        )

        if not file_path:
            return

        if file_path:
            try:
                df = pd.read_excel(file_path)

                if self.table:
                    self.table.destroy()

                self.model = TableModel()
                self.model.df = df
                self.table = Table(self.frame, model = self.model, showtoolbar=False, showstatusbar=False)
                self.table.show()

            except Exception as e:
                tk.messagebox.showerror("Ошибка", f"Не удалось открыть файл:\n{e}")

if __name__ == "__main__":
    root = tk.Tk()
    app = ExcelViewer(root)
    root.mainloop()

r/learnpython 2d ago

Best API's to work on in python; Learning Discord.py for making discord bots.

0 Upvotes

Hello Reddit! I am new, so hope this makes sense. Recently, I've been learning how to make discord bots and script them and make them do silly commands and whatnot, but I have gotten quite stuck on how the scripting part goes because as of right now all I know how to do is to make it send a message on its own. My goal in the end here is for it to make the most chaotic answers on its own, but I have no clue how I will achieve this goal. Any help would be greatly appreciated! :3


r/learnpython 2d ago

Stuck learning python. Asking for advice

2 Upvotes

I've been trying to learn python for months now and know some of the basics, but I'm stuck in tutorial hell. I've been using Mimo alongside 100 Days of Code bootcamp by Angela Yu and although 100 days of code started easy enough, it quickly got overwhelming. I go through the course and think im doing ok but then end up getting stuck trying to figure out the projects at the end of each lesson and then give up and look at the solutions. I really want to learn to use Python with AI but I feel like im not making any progress at all like this. Any advice?


r/learnpython 2d ago

Need code review for my PyQt5 currency converter (handling API requests & GUI structure)

0 Upvotes

Hey guys,

I'm currently learning Python and PyQt5. To practice, I built a small desktop app that works with APIs and handles local data.

Since I want to improve my code quality and learn best practices, I'd really appreciate some help and code review:

  1. Is my PyQt5 structure written properly (signals/slots, layouts)?
  2. How can I better separate the backend/API logic from the GUI components?
  3. Are there any unpythonic bad practices or PEP8 issues in my code?

Here is my code on GitHub: https://github.com/MrAJDebug/disk_cleaner

Thanks for helping me learn!


r/learnpython 2d ago

Does anyone know how to make a drop-down menu?

0 Upvotes

I am learning python so I can save my paint recipes and steps for my warhammer 40k armies and would like to use a drop-down menu to select exact unit. I am going to assign the different unit types as different values


r/learnpython 2d ago

MazeCoders - Python, Flask, JS-based web game

0 Upvotes

First time playing with a Python-based website/app. Built on a docker setup using Python, Flask and JS. Python script auto-generates the levels as the first user to hit that level gets there, then saves the level layout to the DB.

Game concept/ideas as per my 8 year old son.

Built for 6-10 year old kids - starts easy, then gets harder as you go.

I think it came out pretty good for a first attempt at Python.

https://mazecoders.com/


r/learnpython 2d ago

How do you handle Flask + Celery integration with extensions that aren’t fork-safe?

1 Upvotes

Hello! I am working on Flask application that uses celery and have a question concerning how celery spawns worker using prefork in default mode.

I needed to use PyMongo and started reading about its integration with flask and saw in the docs that 'PyMongo itself is not fork-safe'. Suddenly I realized, that the way I use Flask app inside celery may be wrong, though I am following the docs. Here is the code that creates celery app (taken from Flask docs):

from celery import Celery, Task

def celery_init_app(app: Flask) -> Celery:
    class FlaskTask(Task):
        def __call__(self, *args: object, **kwargs: object) -> object:
            with app.app_context():
                return self.run(*args, **kwargs)

    celery_app = Celery(app.name, task_cls=FlaskTask)
    celery_app.config_from_object(app.config["CELERY"])
    celery_app.set_default()
    app.extensions["celery"] = celery_app
    return celery_app

Celery start looks like this then:

  • first Flask application is created in the parent Celery worker process
  • then it is used to create celery app
  • and then this process is forked to create workers.

The problem is that PyMongo client is initialized as part of Flask App creation. But it shouldn't be forked as it is not safe. The same goes for other extensions that use live connections/sockets, as if they are created before fork, they may be inherited by child processes. Or extensions which spawn threads, that won't be copied to child process if I understand how fork works.

So my idea now is that I shouldn't initialize flask app during celery app creation, but I should initialize an app only inside a worker, using '@worker_process_init.connect' for example, and then use this worker specific app to create context for each task that needs it. This way all 'extensions' that are created inside flask app factory will be created inside the process that will be using them.

As my experience with multiprocessing is rather limited, I want to ask the community about this situation. How do you handle celery and flask integration? Should I create Flask application inside each Celery child worker process (e.g. via worker_process_init)? Or should I recreate only the extensions that are not fork-safe after the fork? My concern is not only about PyMongo, as Flask is used with a lot of other extensions and each of them may have its own 'fork' safety, so I am looking for some sort of general solution. Any help will be appreciated.


r/learnpython 2d ago

Comparing 2 tables - Help?

0 Upvotes

Hello guys, I need your help! How to compare 2 tables on easiest way?

I have 2 tables from 2 different systems, but with the same columns. I need to check if every row from the first table exist in another, and if not to return the difference. Can you help me? Should I use excel formulas, python, something else?

Edit: In both systems I have Customer_Id, Phone numbers, mails, their addresses, contact persons and such kind of things in much more columns. I can export data from both systems in excel format. So, now i need to compare these 2 excels and check if every row from 1 table exists in another one, are the values the same for each customer and to find the difference. Sorry for pure explanation, beginner here.

For example:

Custmer Id | Name | Phone | Mail | Contact person | Address

C0001 | Microsoft1 | 123456 | mic1@ | Michael | Str1

C0002 | Linux1 | 234567 | lin1@ | Jack | Str2

C0001 | Microsoft1 | 098765 | mic2@ | Chris | Str3

As you can see, it is possible to have few different informations about customer C0001. I need to check if each row from this table exist in the second table which looks the same.


r/learnpython 3d ago

CVEs in Anaconda (strictly, miniconda)

3 Upvotes

Reposted here because it was autodeleted from r/python. So it goes:

I've been using Miniconda for years on my work laptops. In their wisdom, my benevolent corporate overlords have installed FortiClient on all of our machines to scan for CVEs.

Lately, Forticlient has been detecting vulnerabilities in conda 26.5.3's OpenSSL 3.0.18.0 & 3.0.19.0, and Python 3.13.9150.1013. I've worked with my company's IT provider, & couldn't get those updated. So we tried renaming their folders to break the links, but they just got recreated the next time I ran the anaconda prompt.

So those outdated versions seem to be baked in. Is there anything we can do?


r/learnpython 2d ago

How do you monitor your live/paper trading bots?

0 Upvotes

I've been running an automated strategy (Python + broker API, scheduled via Task Scheduler) for a while now, and I've realized I have zero visibility into whether it's actually working correctly beyond checking logs manually.

Curious how others handle this: Do you get any kind of alert if your bot crashes, an order doesn't fill as expected, or it just silently stops running? Or is everyone just checking manually / staring at logs like me?

Not trying to sell anything — genuinely trying to figure out if this is a real gap or if there's already a good solution I'm missing.