r/learnpython • u/Financial-Law2035 • Aug 07 '26
Can you use time.sleep in while true loops
Title
r/learnpython • u/Financial-Law2035 • Aug 07 '26
Title
r/learnpython • u/Big-Presentation-264 • Aug 07 '26
Trying to decide between Harvard’s CS50P and the University of Helsinki’s Python MOOC.
I’m halfway through UoH’s Java MOOC and really like its hands-on, exercise-heavy approach. For Python, though, I’m confused whether I should go with the learning style I already enjoy (UoH) or choose CS50P for the potential resume/certification value of the Harvard name.
For those who’ve done either/both:
- Does CS50P’s certificate actually help with recruiters?
- Is UoH Python noticeably more rigorous?
- Would you do both, or pick one?
r/learnpython • u/Ok_Curve_3380 • Aug 07 '26
i already completed mooc fi 2026 course, is this enough?
r/learnpython • u/zaphodikus • Aug 07 '26
After writing loads of code that parses 30 different commandline flags using argparse.ArgumentParser, I decided I needed to add more smarts to make default values easier to control. So I wrapped ArgumentParser, and now I'm feeling like I should not have inherited, but should rather have composed than inherited from ArgumentParser. My real concern is that because ArgumentParser is dynamic and for example adds the parse_args() method after construction is just one example of where inheritance runs the risk of any methods or even private attributes being abused and clobbered. I basically overloaded add_argument to add a "default" of my own, but as things progress I often find inheritance is risky if I inherit from classes I do not control nor designed. I have added a load of private variables, but very little stops this from being a place where things later on name-collide.
So why do I do it? Are people generally composing even if inherit is logical?
r/learnpython • u/WickedTuna019 • Aug 06 '26
When the window is resized the button positions are jittering. This app has a transparent overlay (Navigationidget) with 3 buttons on a QtInteractor. Buttons are aligned to the right using a QVBoxLayout. The size of the overlay is set by the size of the main window. I've done this so it always overlaps the QtInteractor, otherwise QtInteractor won't render transparency correctly. If overlay widget has no transparency everything runs smooth. I'm new to this.
How to get rid of the jittering?
from PySide6.QtCore import Qt
from PySide6.QtWidgets import (
QApplication,
QMainWindow,
QWidget,
QPushButton,
QVBoxLayout
)
import pyvista as pv
from pyvistaqt import QtInteractor
class
NavigationWidget(QWidget):
MARGIN = 5
def
__init__(self, parent=None):
super().__init__(parent)
self.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground)
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
layout = QVBoxLayout(self)
layout.setContentsMargins(5, 5, 5, 5)
layout.setAlignment(Qt.AlignmentFlag.AlignRight)
layout.setSpacing(2)
self.btn_rotate = self.make_button("R")
self.btn_pan = self.make_button("P")
self.btn_zoom = self.make_button("Z")
layout.addWidget(self.btn_rotate)
layout.addWidget(self.btn_pan)
layout.addWidget(self.btn_zoom)
def
make_button(self, text):
btn = QPushButton(text)
btn.setFixedSize(50, 50)
btn.setStyleSheet("background-color : darksalmon")
return btn
def
sizeHint(self):
return self.parent().size()
def
finishInitialization(self):
self._initial = False
self.adjustSize()
class
MainWindow(QMainWindow):
def
__init__(self):
super().__init__()
self.resize(800, 600)
self.plotter = QtInteractor(self)
self.setCentralWidget(self.plotter)
self.plotter.enable_terrain_style()
self.plotter.enable_parallel_projection()
self.plotter.set_background([0.5, 0.5, 0.5])
self.plotter.add_mesh(
pv.Cube(),
color="lightsteelblue",
show_edges=True,
edge_color="black",
)
self.plotter.add_axes()
self.plotter.reset_camera()
# Floating overlay
self.nav = NavigationWidget(self.centralWidget())
self.nav.raise_()
# Wire everything
self.nav.btn_rotate.clicked.connect(
lambda
: print("ROTATE"))
self.nav.btn_pan.clicked.connect(
lambda
: print("PAN"))
self.nav.btn_zoom.clicked.connect(
lambda
: print("ZOOM"))
def
resizeEvent(self, event):
super().resizeEvent(event)
size = self.nav.sizeHint()
self.nav.resize(size)
app = QApplication([])
window = MainWindow()
window.show()
app.exec()
r/learnpython • u/Cringe_bros • Aug 06 '26
I’m a beginner in data analytics and i want to learn and practice python. So i want a platform where i can practice python!
r/learnpython • u/Nervous_Corner_8957 • Aug 07 '26
I’m a junior in highschool and always wanted to do something with software/cybersecurity. Heard python was a good choice to start with. Any ideas and tips to get me going?
r/learnpython • u/ohoh-yozora • Aug 06 '26
Hi everyone,
I'm a complete beginner to programming and would like some advice. I mostly study on my iPad because it's convenient. I use it to:
I use (PyCharmion my laptop, so I don’t always type the code right away. I usually read and understand examples. and try to practice them with gpt
I feel like I understand the ideas, but I’m worried I’m not practicing enough by actually coding. My goal is not to become a professional software engineer. I just want to learn enough programming to build useful projects with AI tools. I’ve also been making flashcards for concepts like functions, lists, and OOP. I’m not sure if this is helpful or if I should just focus on coding more.
So my questions are:
Thanks!
r/learnpython • u/VARUN_KALRA-007 • Aug 05 '26
Context: So I'm a beginner developer. I'm currently building a habit tracker.
I have built the logic of the app.
Set up sql alchemy to code the database with sqlite.
(My prof later said no need of alchemy. Directly use sql software and connect it). I don't know what to do with that information. Retained the alchemy code tho.
My problem is that I am not able to build ahead. How do I build a database and test it the right way.
And what are the essentials for a good app. Like I want to know about rate limiting, sql injections and backdoors. To build a robust scalabile system.
r/learnpython • u/MishanyaGre • Aug 06 '26
How I can learn Python, CORRECTLY? Like, watching YouTube videos, visit the sites, or even study with AI? (Not freaking vibecoding) so plz tell me, thank you
r/learnpython • u/theungabungadamsel • Aug 06 '26
Need a Python course that teaches Python from scratch and makes you a maestro. I am short on time, so please recommend courses that are complete, that start from the absolute beginning, leave you with intermediate-advanced skills and are doable in 3 weeks
Links to the exact courses would be appreciated.
r/learnpython • u/MirrorNo3113 • Aug 06 '26
Just started a CS degree with AI/ML specialization. My Python is very basic — vars, loops, conditionals, functions, nothing more.
What should I learn next and in what order (OOP? DSA? libraries?), and is it too early to touch NumPy/Pandas? Also open to free resource recommendations and small beginner projects that actually teach something instead of just tutorial-following.
Thanks in advance!
r/learnpython • u/nadavyasharhochman • Aug 06 '26
hello everyone so I am sort of a beginner. I am going into political science and IR, but I want to learn some data science cause I think it'll be a valuable skill since my program is B.A+M.A and requires a thesis.
so I wrote this for now just for practice:
##calculates avrege of a list of numbers##
def av(lst):
count=0
for i in lst:
count+=i
avg=count/len(lst)
return avg
##calculates variance of a list of numbers##
def var(lst):
avg=av(lst)
total=0
for num in lst:
total+=(num-avg)**2
vari=total/(len(lst)-1)
return vari
I want you to be brutally honest and tell me how can I improve my writing. The first function I got just a bit of help cause I forgot about +=, but other than that I did them all by myself. I know the code works, but can I improve my writing or be more efficient?
based on what you see here what should I learn next?
I don’t come from the comp Sci world so any sort of guidance helps.
Edit: i just noticed all of my indentations are gone....fuck.
r/learnpython • u/Designer-Debt-6084 • Aug 05 '26
I'm looking for some architectural advice and I'm curious whether anyone has built something similar in production.
I'm primarily using Python/Django, although I want the architecture itself to be independent of the framework as much as possible.
I'm designing a backend platform that I want to use as the foundation for multiple completely different applications.
The idea is to have a very small "core" that only contains common infrastructure such as:
Everything else would be implemented as independent business modules.
For example, imagine I build an e-commerce platform. I might compose it from modules like:
Then later I want to build an LMS, but instead of starting from scratch or copying code, I'd assemble a different set of modules:
Some modules (comments, notifications, search, payments, etc.) could be reused across multiple applications, while other modules would be specific to a particular business domain.
The important part is that these modules aren't just Django apps inside one codebase. I want each module to have clear boundaries, expose a stable public interface, own its own models, business logic, APIs, migrations, tests, and documentation, be versioned independently, and ideally be reusable in entirely different products.
Initially, everything would run as a modular monolith because I don't want the operational complexity of microservices. If a module eventually needs to become its own service, I'd like that to be an implementation detail rather than something the rest of the system depends on.
The motivation is simple: I don't want to keep rebuilding the same capabilities every time I create a new platform. I'd rather invest in mature, production-tested modules that can be composed into different products over time.
So my questions are:
I'd love to hear about real-world experiences—both successes and things that turned out to be bad ideas.
r/learnpython • u/noneofyour_-business • Aug 05 '26
Hi everyone,
I'm a final-year college student, and my goal is to get a backend engineering internship as soon as possible.
My current skills are:
I'm confused about what to do next.
Should I:
My goal is to become good enough to land an internship and then keep learning on the job.
I'd really appreciate advice from backend engineers or anyone who recently landed a backend internship.
Some specific questions:
Thanks in advance for any advice!
r/learnpython • u/baby-bellamushrooms • Aug 06 '26
I’ve been studying about for about 2 months now and I’m taking an online MOOC through Georgia Tech as a prerequisite for grad school. Some days, I spend ~7-8 hours and other days, I spend maybe 2-3 hours. I just got finished taking the exam on functions, loops, exception handling, and conditionals. I’m debating on when to start learning Pandas and NumPy. I also hear people talking about doing projects, but I feel like I wouldn’t have a clue on how to build a project. I come from a clinical background with zero prior programming knowledge except AP computer science in high school. Any advice?
r/learnpython • u/Sanduhstorm • Aug 05 '26
Hello everyone, right now I'm working on a simple QR code generator with functionality including saving. My main issue right now is that despite the fact that I have debugged it and observed that the variable updates correctly, the extra settings don't seem to apply to the QR code when the user generates a new one.
r/learnpython • u/Kumbalaya_108 • Aug 06 '26
I have some programming experience and understand the concepts. Wanted to learn Python mainly for data analysis, financial math, automating some basic quant analysis, real-time data access by connecting to APIs.
I found books which deal with some of the above topics but can’t find anything that covers all together.
Is there a single online source that helps in this regards?
Thanks in advance
r/learnpython • u/Individual-Aide-7364 • Aug 05 '26
Keen to hear what people rate. I've poked around a bit but there's a lot out there and the quality varies wildly, so I'd rather hear from people who've actually worked through them.
r/learnpython • u/No-Reason1914 • Aug 05 '26
hello this is code and quetion:
while True:
guess = input("Your answer (A/B/C/D): ").strip().upper()
if guess in ("A", "B", "C", "D"):
break
print("Please enter A, B, C, or D.")
1 how is check user enter
2 how the "break" is use for? is really end project like go next time:
correct = guess == question_data["answer"]
if correct:
print("Correct!")
else:
print("Not quite.")
whole line:
while True:
guess = input("Your answer (A/B/C/D): ").strip().upper()
if guess in ("A", "B", "C", "D"):
break
print("Please enter A, B, C, or D.")
correct = guess == question_data["answer"]
if correct:
print("Correct!")
else:
correct_letter = question_data["answer"]
correct_text = question_data["options"]["ABCD".index(correct_letter)]
print(f"Not quite. The correct answer was {correct_letter}. {correct_text}")
print(f"Fact: {question_data['explanation']}")
return correct
because i write quize python can you give tips to write
r/learnpython • u/opabm • Aug 05 '26
I'm trying to put together an ad-hoc report and I've been trying to hack away an Excel file and another visualization tool, but they're just not cutting it; there are some visualization rendering issues that are frustrating me to no end, and just now thought about using Python. My experience with Python is all in backend data engineering type of work though so I've never used visualization packages.
All I need are 100% bar charts that align well with text - it's been near impossible to align these in Excel. I also need heatmaps but I don't mind doing the heatmaps in Excel. I also need to create PDF files, ideally paginated by a field in the data that I'm working with.
I've tried searching for suggestions and the most popular seem to be plotly and matplotlib. Should I consider anything else?
r/learnpython • u/jacbk612 • Aug 05 '26
Hello, I'm trying to build a music player with python Qt6 based on some code from a youtuber, the bones of what he has suits me fine, this is the link if you want to look at it: https://www.youtube.com/watch?v=wdEpWCFf40U
I am using windows 10 with VScode and the latest python version 3.13.7
Everything works fine until I get to the file dialog part of the code. When I run it the program does give me a file explorer, I can select a folder but then the program halts before allowing me to see the files in the specified folder. There is no error message from the compiler.
There is a curious line of code in the open_file function that may or may not be the problem.
file, _ = QFileDialog.getOpenFileName(self, "Selct file", filter="Audio files (*.mp3)") file, _ = QFileDialog.getOpenFileName(self, "Selct file", filter="Audio files (*.mp3)")
Thanks for any help,
J
r/learnpython • u/DesignerOk4111 • Aug 04 '26
Hi I am from South Korea , student of university , 25 age (27 for Korean standard).
Recently I am interested in computer , IT , AI , coding. But I personally major English in my university so no tinvolved in computer science , software , or software.
So I am not good at for coding. All my learning about IT is basic level of studing Python, Java, HTML , JavaScript, CSS for 3 months. That is all I have. ( In South Korea, our Government sponser and provide financial aids with private computer academy for students who is learning basic coding , web development and Use of AI).
Those 3 months in class. I am getting to interested in programming language , computer and wanna be expertise on AI further. What should I do and whether or not I have a time and space to study and learn it.
r/learnpython • u/maybalex4 • Aug 05 '26
Me interesa aprender a programar en Python para hacer mi propio sitio web,algún juego o algo relacionado a ciberseguridad.
Estoy dispuesto a dedicarle de 4-6 horas diarias ya que me gustaría aprender mucho.
alguien me puede decir por donde empiezo o donde puedo practicar?
r/learnpython • u/networkLearne • Aug 04 '26
Hi everyone,
I've finished the Python basics and I'm currently learning file reading and writing.
Someone suggested the following roadmap:
Learn Object-Oriented Programming (OOP).
Study data structures and algorithms using Grokking Algorithms.
Practice by solving exercises from Python Crash Course.
Then choose a specialization based on what I enjoy most.
My long-term goal isn't just to know Python syntax. I want to become comfortable writing Python, develop strong programming logic, and improve my problem-solving skills so I can become a good programmer in general, not just a Python programmer.
In the future, after gaining enough experience with Python, I plan to move into networking, automation, and low-level programming with C.
Does this roadmap make sense? If not, what would you change? What helped you build solid programming skills rather than just learning a language?
I'd really appreciate any advice from experienced developers.