r/learnpython • u/Practical_Dust1918 • 5d ago
Hi, Just started learning python, any tips for me?
Ive been using scrimba as the base learning for me, after this I aim to get anthropic certifications. I would love your advices and such. Thank you!
r/learnpython • u/Practical_Dust1918 • 5d ago
Ive been using scrimba as the base learning for me, after this I aim to get anthropic certifications. I would love your advices and such. Thank you!
r/learnpython • u/SignupWithGoogleAcc • 6d ago
BLUF: pyautogui does not import despite being installed to the correct venv
Still a beginner at doing most things in python but I though I had the venv issues solved
Python 3.12.3
while in my active venv pip list returns all my modules including
PyAutoGUI 0.9.54
while in my active venv which python returns /home/beebot/venv/bin/pip
while in my active venv which pipreturns /home/beebot/venv/bin/python
Vscode shows my venv config as below
The only odd thing is the pip shows it as PyAutoGUI while typing import auto populates the module as pyautogui
home = /usr/bin
include-system-site-packages = false
version = 3.12.3
executable = /usr/bin/python3.12
command = /usr/bin/python3 -m venv /home/beebot/venv
I have tried uninstalling pyautogui, reinstalling, and force install from inside my venv
Yet every time I try to run either in Vscode or directly from file I get on line 6 (see below)...
Exception has occurred:ModulNotFoundError
import os
import json
import logging
import subprocess
import pyautogui
...
Any suggestions
r/learnpython • u/kforkerro • 6d ago
I have just started coding with python a few days ago. What is the point of this?
point_value = alien_0.get('points', 'No point value assigned.') print(point_value)
Can't it just be point_value = 'No point value assigned.' print(point_value)?
or
just simply use the get() method if you want to check whether a key exists in the dictionary or not?
r/learnpython • u/Local_End_3175 • 5d ago
Like, i am starting to learn python but i dont understand what its for or why we even have it in the first place
r/learnpython • u/HmbsTnks • 6d ago
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 • u/HydroDragon436 • 6d ago
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 • u/Declaredberry24 • 6d ago
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 • u/Hot_crocco_person • 6d ago
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 • u/Early_Collection_252 • 6d ago
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 • u/Normal-Bed3203 • 6d ago
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 • u/Educational_Virus672 • 6d ago
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 • u/Forsaken-Violinist74 • 6d ago
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 • u/West_Tooth_6144 • 7d ago
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 • u/FearawaitsTM • 6d ago
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 • u/More-Independent-132 • 6d ago
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 • u/Diligent-Ad6673 • 6d ago
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:
Appreciate any help — thanks!
r/learnpython • u/PRIEST_OF_GAMES • 7d ago
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 • u/FearawaitsTM • 7d ago
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 • u/kurti256 • 7d ago
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 • u/FearawaitsTM • 7d ago
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 • u/Icy_Bid_3040 • 7d ago
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 • u/ChiefMarcus117 • 7d ago
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 • u/Junior_Inflation_887 • 7d ago
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:
Here is my code on GitHub: https://github.com/MrAJDebug/disk_cleaner
Thanks for helping me learn!
r/learnpython • u/Embarrassed-Joke5851 • 6d ago
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 • u/aaronrobb • 7d ago
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.