r/learningpython • u/[deleted] • Aug 13 '20
Empty classes
I recently stumbled upon empty classes in python but I still couldn't understand the benefit of such a feature. Can someone explain what is the purpose of an empty class ?
r/learningpython • u/[deleted] • Aug 13 '20
I recently stumbled upon empty classes in python but I still couldn't understand the benefit of such a feature. Can someone explain what is the purpose of an empty class ?
r/learningpython • u/Abi-Eshu • Aug 10 '20
Hi there,I've gone through multiple structural edits of this code. Ive been referencing others code but for some reason past students in this project have been able to produce multiple epochs with quantative data yet mine is returning flat.Can anyone see what im doing wrong?I know the libary im referring to is properlly linked as ive manage to make data graphs higher up in the notebook.

r/learningpython • u/subhchatu • Aug 03 '20
Github page. i have been learning python for the past 1 year, this is my first project that i want to share. Its a program to sort all files in a directory into appropriate sub-directories it creates. Please give me feedback and all kinds of criticism based on my code.
r/learningpython • u/giedosst • May 08 '20
Hi everyone.
I’m new to programming having tried to learn it as a skill for years and am dabbling with building GUI programs in python.
Things are getting interesting.
Now my question is this:
Is there a way to see what I’m building in real time? I’m ask because I’m dyslexic and I think and learn visually and it takes extra time to go through the code and try to imagine what things look like or what code is effecting what when I type it.
Obviously once I run the code I can see it but it’s very abstract trying to imagine a shape and a object when I read lines of code.
Is this at all possible or is this just the nature of the beast so to speak?
Thanks.
r/learningpython • u/Bmanyo69 • May 07 '20
...I am learning python and idk which ide to use
r/learningpython • u/byebm • May 07 '20
Edit: Problem solved, see bottom.
Hello! New here, apologies if formatting needs work. I did my best to search for this issue, but I don't see any posts/previous questions about this issue.
Learning via PY4E and I keep trying the example provided in Chapter 3 Part 2. The following is provided in video (12 minute mark, but when I try to apply the script in Python, it actually does not run as intended when a non-integer is submitted.
From what I understand, input() returns a string-type variable. But shouldn't that mean the try/except logic applies when the string fails to be converted to an integer with int()?
Any and all help would be appreciated as I'm banging my head against the wall trying to figure it out myself.
rawstr = input('Enter a number:')
try:
ival = int(rawstr)
except:
ival = -1
if ival > 0:
print('Nice work')
else:
print('Not a number')Error
Traceback (most recent call last):
File "3_Lesson_Notes.py", line 1, in <module>
rawstr = input('Enter a number:')
File "<string>", line 1, in <module>
NameError: name 'Three' is not defined
Solution (?)
So, after a bit more digging I found that by executing the script in the terminal just as "python", it doesn't like the non-integer input unless I put it in quotes. So the problem that I'm still not 100% understanding but I suppose I have a workaround for is:
A) Executing the script via python in the terminal requires using "" for any non-integer input.
B) Run the script but ensure that I'm clearly executing via python3 as opposed to just typing in python "file name".py
r/learningpython • u/[deleted] • Apr 14 '20
I have chosen Python and start learning the language today. Since it is my first programming language, I have no idea about it and wanted to ask if there are some tips for beginners :)
Something that might help me in the future or what you would have liked to know when you started.
Thank you in advance! Stay healthy.
r/learningpython • u/Lostwhispers05 • Apr 02 '20
So the script I'm deploying makes use of the docx-mailmerge library. It has one line in it where a file's name and path need to be passed in - how I usually do it locally is I simply pass in the path to the file, but I'm not sure how this would be replicated if it were running in a cron job.
I figure there has to be a solution to something like this, a way to store the files necessary in some kind of temporary folder, right?
I'm hoping to be able to:
Download the file from S3,
Dump it into a folder that my script will create,
simply reference it from the folder where I just dumped it.
Wondering if that's something that would be possible.
r/learningpython • u/Mad-Hat-ter • Mar 29 '20
Im new to programming and Im trying to find the most user friendly IDE for using python. Something with multiple to windows to display, also would like having a terminal and a place to write code(whatever that’s called) Im probably getting VScode to use java on. Does VScode also work with python?
r/learningpython • u/Missylovebug223 • Jan 11 '20
r/learningpython • u/Dap0k • Dec 05 '19
Hello I recently joined a job that I had at first thought was gonna need some. Background in programming.
Turns out the job was more clerical in nature and very limited in terms of me being able to apply my basic knowledge in python there.
Is there a way to learn python via audio like podcasts and audio books? I understand that it's better to see and do thing when learning to code, but my schedule is very tight and the job pays too well for the kind of work I do for me to just give it up immediately.
At the very least if I found a way to learn python via audio while I do my clerical work. I'll still be learning
r/learningpython • u/hasanyoneseenmyshirt • Oct 07 '19
This might be a simple question and maybe the answer is right there but here is a simple code to try to explain my confusion.
class Person:
def __init__(self,name,age):
self.name=name
self.age=age
def get_name(self):
print(self.name)
class Girl(Person):
def _init__(self,name,age):
super().__init__(name,age)
self.gender="Female"
class Boy(Person):
def __init__(self,name, age):
super().__init__(name,age)
self.gender ="Male"
Jack=Boy("Jack",21)
Jill=Girl("Jill", 21)
hasattr(Jack,"gender")
//Gives me False
hasattr(Jill,"gender")
//Also gives me FalseSo my question how come the Boy object and the Girl object don`t get the gender attribute. I know they inherit the Person objects attribute of age and name.
class Person:
def __init__(self,name,age):
self.name=name
self.age=age
def get_name(self):
print(self.name)
class Girl(Person):
self.gender="Female"
def _init__(self,name,age):
super().__init__(name,age)
class Boy(Person):
self.gender="Male"
def __init__(self,name, age):
super().__init__(name,age)
Jack=Boy("Jack",21)
Jill=Girl("Jill", 21)
hasattr(Jack,"gender")
//Gives me True
hasattr(Jill,"gender")
//Also gives me TrueThis varietion seems to work. I know why this works, but aren't the two codes kind of the same?
r/learningpython • u/[deleted] • Apr 23 '19
r/learningpython • u/nachiket87 • Apr 17 '19
I recently moved to a new country. No distinguished skill set. I work in a dead end sales job that I’m not very good at. I’ve worked in several industries but was never very successful in the sales role. Perhaps I don’t have the sales personality.
I’ve been toying with the idea of learning programming as I feel this is a skill that can be learned with sufficient practice regardless of previous qualifications. I have always had an inclination to learn but never followed through. Joined a C class when I was 16 for a couple of months and also took JavaScript for a few months last year.
I’ve toyed with JavaScript and C and have a fair idea of the basics - loops, if statements, conditions, functions etc.
I was wondering if it’s a good idea to start off with Python as it feels like the perfect language to start with - highly in demand, not complicated syntax, lot of resources to learn online.
I’m currently reading automate the easy stuff.
I wanted to know if this is a good idea to start learning now (at 31). Im willing to dedicate all my free time to this. Do you think it’s possible for someone to learn it to a level where you can eventually be employed in a year or should I just keep it as hobby? Also, any helpful resources would also be appreciated where I can learn with a low budget. (<1000 $).
Thank you!
r/learningpython • u/fundor333 • Aug 20 '26
I need to frame a lot of my photos adding in the frame the config of the camera, camera model and camera lens and I am a lazy man so I code it with Python. If you have suggestion or comment I LOVE to read them
r/learningpython • u/ANautyWolf • Aug 10 '26
So I have a Pydantic BaseModel called Latitude. It is the following:
class Latitude(BaseModel):
latitude: DecimalI then have another BaseModel called SetReferencePoint that includes Latitude in its attributes. I've tried testing the SetReferencePoint BaseModel with Hypothesis using:
st.from_type(type)
I then get a ValidationError as follows with a couple tests (minus the url portion):
{'type': missing, 'loc': ('lat', 'Lat'), 'msg': 'Field required', 'input': {}}
The rest of the tests throw a 'model_type' error as expected.
I want to prevent an empty dict from being accepted as an input which would prevent the 'missing' error from showing up in the first place. How can I do this? Should I use 'field_validator'? If so how best to set it up and test it?
r/learningpython • u/After_Ad8616 • Feb 04 '26
What rules do you give beginners about using AI to learn Python?
I’m helping r/neuromatch run a free Python for Computational Science Week using their open-source tutorials. We realized our materials don’t currently include any guidance on how or when learners should use AI while learning to code. We’re planning to update that and would love broader input.
We’re generally excited about AI as a coding tool but we’re also aware that it can short-circuit learning, especially in the first days or weeks. One idea we’re leaning toward is something like:
Try to write the code yourself first
Use AI to debug, explain errors, or suggest improvements
Don’t copy/paste code you don’t fully understand
Be more cautious using AI in your very first week of learning Python
For those who teach Python or learned with AI in the mix:
What advice did you get that you found helpful?
When does AI genuinely help learning?
When does it get in the way?
Curious to hear how others approach this or if there are citations you can point me to! Thanks!
r/learningpython • u/Major-Language-2787 • Jan 18 '26
This is in a while loop called is_bidding
Code A:
resume = input("Is there another bidder? Type 'yes' or 'no': \n").lower()
print(resume)
if resume != 'no' or 'yes:
print('We will take that as a no')
is_bidding = False
elif resume == 'yes':
print("Let us resume.")
else:
print("Very well let's see whose won...")
is_bidding = Falseintentions: I wanted the if statement to check if the user did NOT enter 'yes' or 'no'
results: When typing 'yes', the first condition runs, and I am not sure why
Edit: Thanks for the feedback, I understand what I did wrong.
r/learningpython • u/[deleted] • Jan 09 '26
Hey guys,
I had been grinding Leetcode for the past two months and I had been using an AI workflow to help me understand the questions better.
It utilizes MC quizzes and open-ended probing questions to test your understanding while allowing you to ask clarifying questions.
I later built a scaffolding app around this core workflow and I am now giving out a free lifetime usage for the first 20 users.
Thanks
Vincent
r/learningpython • u/fastlaunchapidev • Jan 04 '26
Hey
I wanted to share a side project I built while getting deeper into Python: FastLaunchAPI.dev.
It’s a production-ready FastAPI template, but I’m posting here mainly to share what I learned while learning Python and moving from scripts to real-world apps.
What helped me most when learning Python
If you’re aiming to build real products with Python, these things made the biggest difference for me:
- Building something real early, even if it was messy
- Learning async and how async/await actually works
- Reading other people’s code, especially FastAPI projects
- Focusing on one framework instead of jumping between many
- Treating errors and stack traces as learning tools, not blockers
Why I built this
After a while, I noticed I was rebuilding the same things in every project:
auth, configs, database setup, payments, deployment prep.
So I decided to turn that repetition into a reusable FastAPI template that reflects how I now approach Python projects.
If you’re learning Python and want to build APIs
FastAPI was a big unlock for me because:
- It forces you to understand typing
- It encourages clean structure
- You get instant feedback via docs and validation
You don’t need to build something like this to learn, but building real APIs helped everything click for me.
If this is useful
Site: https://fastlaunchapi.dev
Happy to answer questions about learning Python, FastAPI, or turning side projects into real products.

r/learningpython • u/fightin_blue_hens • Oct 11 '25
When I run a .bat file that isn't in the same folder as the .py file I'm running, the code gives me a "FileNotFoundError: [WinError 3] The system cannot find the path specified:" error. But when the .bat file is in the same folder, it runs with no issue. Can someone explain why? the error occurs on a call using os to list all the files in a folder. I even have the full paths listed for the python.exe and the python code in the batch file.
Full error:
"File "C:\Users\<username>\Desktop\CBB Model\CBB_Test_2024-2025\3_track_stats.py", line 600, in <module>
file_list = os.listdir(halve_start_loc)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\<username>\\Desktop\\CBB Model\\Schedule\\All Halves Adjusted\\Adjusted Halves\\'Python Code here:
import pandas as pd
import numpy as np
import re
import os
import pathlib
from os import listdir
import datetime as dt
from datetime import timedelta
pd.set_option("display.max_rows", None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
pd.options.mode.chained_assignment = None
main_folder_loc = pathlib.Path().resolve()
main_folder_loc = str(main_folder_loc)+ "\\"
halve_start_loc = main_folder_loc + "Schedule\\All Halves Adjusted\\Adjusted Halves\\"
halve_end_loc = main_folder_loc + "Schedule\\All Halves Adjusted\\Adjusted Halves with stats track\\" 600 lines of functions and mainif __name__ == "__main__":
file_list = os.listdir(halve_start_loc) ##error occurs here
main(file_list)Batch Code Here:
@echo off
"C:\Users\<username>\AppData\Local\Programs\Python\Python314\python.exe" "C:\Users\<username>\Desktop\CBB Model\CBB_Test_2024-2025\3_track_stats.py"r/learningpython • u/BigOnUno123 • Sep 13 '25
Link to the App Store page: https://apps.apple.com/app/6749594445
Hello everyone, I wanted to share my new Learn to Code app, EasyDev. I built this app using Swift UI in around 4 months, and it is actually my first ever Swift project. I am coming here to gain some eyes on my app, and give me suggestions on what I can do to make my app better and grow as a developer.
The app itself was made exclusively by me, including all the programming, UI, assets, logos, etc. The actual learning content was also handcrafted by using structures similar to popular websites such as Edube and Learncpp, and there is a lot of interactive and descriptive content that takes inspiration from these websites, which are very popular for their effectiveness in teaching people how to code.
If you are interested in learning programming or just want to check the app out, please consider downloading the app using the link above. Also, if you experience any bugs or errors of any kind, please go to the Discord (in the app store page or directly in the app (Settings -> Join the Discord)) and let me know. Thanks in advance!
r/learningpython • u/Juhshuaa • Jun 21 '25
i’m looking to build (or at this point even pay) a mini video editing software that can find black screen intervals from my video then automatically overlays random meme images on those black parts, and exports the edited video.
r/learningpython • u/throwaway-check-4579 • May 31 '25
I'm working on the decryption portion of the exercise. It was recommended to use the modulo function to perform the alphabet letter shift.
While I am slowly understanding the modulo shift for encrypting (moving forward in the alphabet) - I'm not understanding how the modulo shift works for decrypting (moving backward in the alphabet):
My specific issue:
Let's say that you're working with the "c" character (index position 2), with the idea of decrypting it, by shifting backwards 5 spaces. you get the "x" character as the decoded letter (index position 23).
How does one divide -3 by 25 to get mod 23?
If someone could explain that, I'd be really grateful.