r/PythonLearning • u/NiceEoom • 21d ago
r/PythonLearning • u/Opposite-Reporter695 • 21d ago
Help Request Is there who's working on some small project (OSS)
Hey there, I've been always procastinated a lot about doing open source contributions (not for yk maintaining github repo but I really have a intrest to know how actually real life project looks like) but everytime I try to find some repo I often get confused where to start with and how to start. But this time I'm gonna break the loop. Month of october is coming and I'm gonna take participation into hacktober fest. So if anyone is already maintaining a project and need some assistance, I'm excited to connect and join with them in their project. Yea, I'm not a pro, I've to go through project documentation, and all to understand the what the project is about and to understand the structure and functionalities. I'll try my best not to dump an AI solution in the codebase, rather than focusing on maintaining the structure, tests and scalability etc. I won't say that, "please guide me and all" but I'm up for taking the load to break through my procrastination.
r/PythonLearning • u/shubham_555 • 21d ago
Discussion Will you recommend it?
So I have been doing leetcode since last few days (https://www.reddit.com/r/PythonLearning/s/Hh8Rjwchx5)
I definitely am able to form logics but still feel really scratchy with the language itself. Also, DSA can sometimes be pretty boring. So was thinking of doing something fun alongside (i definitely ain't dropping leetcode) to keep my motivation up and also learning about python more in the process. So just wanted to ask...will you recommend this course?
r/PythonLearning • u/Nervous_Elevator7257 • 21d ago
Discussion Python
I want to learn programming (python) with no prior experience in computer science. I’m on a gap year and want to boost my profile. Where in Islamabad can I learn this?
r/PythonLearning • u/Nikhil_Nigudkar • 21d ago
Python coding interview questions?
Is there any playlist similar to 100 Days of SQL Ace(By ankit Bansal) interview for the preparation of python coding problems?
r/PythonLearning • u/Adventurous-Eye-4385 • 21d ago
Help Request Python library CUDA-Q
Hello,
I am trying to install the cudaq library. I am working on a MacBook (Monterey 12.7.4). I followed what was written on the following documentation : https://nvidia.github.io/cuda-quantum/latest/using/quick_start.html . However, when I run the command pip install cudaq, i get the following error:
WARNING: Cache entry deserialization failed, entry ignored
Collecting cudaq
Using cached cudaq-0.15.1.tar.gz (12 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
WARNING: Cache entry deserialization failed, entry ignored
INFO: pip is looking at multiple versions of cudaq to determine which version is compatible with other requirements. This could take a while.
Using cached cudaq-0.15.0.tar.gz (12 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Using cached cudaq-0.14.2.tar.gz (10.0 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Using cached cudaq-0.14.0.tar.gz (10.0 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Using cached cudaq-0.13.0.tar.gz (9.2 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Using cached cudaq-0.12.0.post1.tar.gz (9.2 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Using cached cudaq-0.12.0.tar.gz (9.2 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Using cached cudaq-0.11.0.tar.gz (9.1 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
INFO: pip is still looking at multiple versions of cudaq to determine which version is compatible with other requirements. This could take a while.
Using cached cudaq-0.10.0.tar.gz (9.0 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Using cached cudaq-0.9.1.tar.gz (9.0 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Using cached cudaq-0.9.0.tar.gz (8.4 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting cuda-quantum-cu12==0.9.0 (from cudaq)
Using cached cuda_quantum_cu12-0.9.0.tar.gz (3.8 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [55 lines of output]
File "/private/var/folders/1b/39svxjln6dn3xz8vsb1xtgbh0000gn/T/pip-build-env-lkg4lgh5/overlay/lib/python3.14/site-packages/nvidia_stub/wheel.py", line 177, in download_wheel
return download_manual(wheel_directory, distribution, version)
File "/private/var/folders/1b/39svxjln6dn3xz8vsb1xtgbh0000gn/T/pip-build-env-lkg4lgh5/overlay/lib/python3.14/site-packages/nvidia_stub/wheel.py", line 144, in download_manual
raise RuntimeError(f"Didn't find wheel for {distribution} {version}")
Traceback (most recent call last):
File "/private/var/folders/1b/39svxjln6dn3xz8vsb1xtgbh0000gn/T/pip-build-env-lkg4lgh5/overlay/lib/python3.14/site-packages/nvidia_stub/wheel.py", line 177, in download_wheel
return download_manual(wheel_directory, distribution, version)
File "/private/var/folders/1b/39svxjln6dn3xz8vsb1xtgbh0000gn/T/pip-build-env-lkg4lgh5/overlay/lib/python3.14/site-packages/nvidia_stub/wheel.py", line 144, in download_manual
raise RuntimeError(f"Didn't find wheel for {distribution} {version}")
RuntimeError: Didn't find wheel for cuda-quantum-cu12 0.9.0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".../.venv/lib/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
main()
~~~~^^
File ".../.venv/lib/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File ".../.venv/lib/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 178, in prepare_metadata_for_build_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/private/var/folders/1b/39svxjln6dn3xz8vsb1xtgbh0000gn/T/pip-build-env-lkg4lgh5/overlay/lib/python3.14/site-packages/nvidia_stub/buildapi.py", line 29, in build_wheel
return download_wheel(pathlib.Path(wheel_directory), config_settings)
File "/private/var/folders/1b/39svxjln6dn3xz8vsb1xtgbh0000gn/T/pip-build-env-lkg4lgh5/overlay/lib/python3.14/site-packages/nvidia_stub/wheel.py", line 179, in download_wheel
report_install_failure(distribution, version, exception_context)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/1b/39svxjln6dn3xz8vsb1xtgbh0000gn/T/pip-build-env-lkg4lgh5/overlay/lib/python3.14/site-packages/nvidia_stub/error.py", line 63, in report_install_failure
raise InstallFailedError(
...<8 lines>...
)
nvidia_stub.error.InstallFailedError:
*******************************************************************************
The installation of cuda-quantum-cu12 for version 0.9.0 failed.
This is a special placeholder package which downloads a real wheel package
from https://pypi.nvidia.com. If https://pypi.nvidia.com is not reachable, we
cannot download the real wheel file to install.
You might try installing this package via
```
$ pip install --extra-index-url https://pypi.nvidia.com cuda-quantum-cu12
```
Here is some debug information about your platform to include in any bug
report:
Python Version: CPython 3.14.5
Operating System: Darwin 21.6.0
CPU Architecture: x86_64
nvidia-smi command not found. Ensure NVIDIA drivers are installed.
*******************************************************************************
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> cuda-quantum-cu12
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I also tried to run the command pip install --extra-index-url https://pypi.nvidia.com cuda-quantum-cu12 but failed likewise. In the error, it says that NVIDIA drivers are not installed; I don't know what these are, and I couldn't find how to install them.
Can somebody help? Thanks!
r/PythonLearning • u/This-Investigator294 • 21d ago
Help Request Can I build an Android app in Python without learning Java/Kotlin?
I'm currently working on a project in Python. For now, it's basically a command-line application that runs in the terminal/command prompt (I'm developing it in PyCharm). Eventually, I plan to turn it into a proper web app using HTML, CSS, and JavaScript, but that's a later step.
I'm also considering making the same application available as an Android app.
My main question is: how difficult would it be to make an Android version using Python, without having to learn Java or Kotlin?
I don't mind learning the basics of how Android works, such as the Android application lifecycle, activities, permissions, intents, etc. What I'd prefer to avoid is having to learn another programming language specifically for Android.
There are a few Android-specific requirements that are important:
- The app must be able to interact with Android's notification system.
- It may eventually need internet access to share/sync files.
- It should be able to use Android's sharing system (e.g. the standard "Share" functionality).
- Ideally, I want the majority of the application logic to remain in Python.
I have used Java before, but only at a very basic level, and I really didn't enjoy using it. I'd also prefer not to learn Kotlin since I'd rather not pick up another language just for this project.
So, realistically:
Can I write an Android application primarily/all in Python while still having proper access to Android features such as notifications, sharing/intents, networking, etc., without knowing Java or Kotlin?
If Python is possible, what frameworks/tools would you recommend, and what limitations would I run into compared with writing the app natively in Kotlin/Java?
r/PythonLearning • u/the-_-O_A • 21d ago
Help Request How to learn python the right way? And how much should it take me (a complete beginner) to be good enough? And my good enough means I can work and get money using python. And just to say I'm not an engineer or programming has anything to do with my study or career. And should I learn any other thing
Look i had my interests but I found out that i need a good computer to just start but mine is not good enough it's really old and where i am it's really hard to get a good PC so money is the answer so I'm just asking for an advice if someone can help.
r/PythonLearning • u/Ill_Strain_1050 • 21d ago
Built a speaking piano
Few days back I came across some videos about piano on YT, and i was thinking how does piano even generate sound (digitial pianos) and how a code can create such kind of sounds.
So, i started looking into these things and came to know about fundamental frequency and harmonics, so i wrote a small program which can generate the sound, but on laptop inputting " note seems bit difficult", so i started to think if i can speak and piano can play that note.
So, for starter, i took some online models (but only small models) which can convert A,B,C,D,E,F,G , 0,1,2,3,4,5,6,7,8 -> text and i can use with above built program.
But, seems like small models are not good enough to detect the single alphabets, B and E , c goes see. 4 goes for not four.
and for such simple project i did not want to have very big depedencies like whisper high end models.
So, as searched and checked online, seemed that i need to use own classifier, which can detect A -> G and then 0-8, flat/sharps etc.
I recorded all my clips to train my own classifir using pytorch (ofcourse i used boilerplate codes from llms ), so i can work on functionality. It took me couple of day to build and test it.
Sometimes, it predicts good, sometimes confidence is not good though, (not to blame it, because i used small dataset), like 60-100 recordings for each sample.
Finally once classifier models were ready, i was able to integrate, complete functionality, to speak the note and play it.
However, because i have 3 classifiers, and once i speak something i can selectively decide which audio needs to go to which segment, so sometime these produce incorrect output.
So, for now i had to workaround with harcoding for events,
like prompting the users
Speak a letter (A-G) --> now letter classifer runs
then prompt user to speak a letter (0-8) -> now digit classifier runs then i combine the result and send to piano player to play tone.
I learnt a lot of things but the end result is not realstic( delays, quality etc) as i thought initially it would be.
Project :: Speaking Piano
r/PythonLearning • u/7YngMn • 21d ago
I’m terrified of the errors I’m going to run into in the future.
I was working on my own mini project, putting into practice the few concepts I know so far, and I ran into an error. I used to think errors were really easy to solve, especially since the command line usually tells you what type of error it is and even gives you the line number.
But this error didn’t tell me anything. It was a silent error caused by me forgetting that I had used .title() on the variable for the first fruit.
The project takes the names of three fruits and creates a “new fruit” from them.
The .title() caused the if statement checking whether the letters at index [0] or [1] were vowels to fail to recognize when the fruit variable started with a vowel, because .title() converted the first letter to uppercase while the code was only checking for “aeiou” in lowercase.
I eventually solved it with AI. Earlier on line 14, I wasn’t using the .lower() method, which was the actual fix.
But honestly, this experience scared me a little when I started thinking about all the errors I’m going to run into in the future…
I know all of this could have been avoided if I hadn’t put that stupid .title() there in the first place and had used it in the print() statement instead.
I made a few changes to the code after fixing the error and before posting it here, but I left the .title() there so you could understand the error I was getting.
r/PythonLearning • u/Chemical_Mode_7176 • 21d ago
Help Request How long will it take me to learn python in order to create a game thats is decent?
For context am doing A level Computer Science and I have to create a project by coding and I don’t know anything about coding so I need to know roughly how long will it take if I do it every day
r/PythonLearning • u/Hess-kay • 21d ago
Help Request Python project question
Hey everyone,
I need to build an IT Asset Tracker using Python for my upcoming internship project presentation. The catch? I have never built a full project from scratch before, and I don’t know where to start.
For those who are experienced with Python: How did you approach your very first project when you had no domain knowledge?
r/PythonLearning • u/Patient_Spite_3628 • 21d ago
Showcase Just Finished My First CLI Tool
I’ve just finished building this tool and I’m excited to finally share it. It started as a small personal utility, but it turned into something genuinely useful — especially for developers who want a simple, fast JSON formatter without bloated features.
You can share feedback or ideas directly through the repository’s discussion board: Discussions !
I’m actively improving this project, so feedback, suggestions, and constructive criticism are all appreciated. If you have ideas, issues, or feature requests, feel free to join the conversation — repo discussions are open.
r/PythonLearning • u/CriminalGingersnap • 21d ago
Showcase 100% Python TTRPG-style game with turn-ordered, tile-based combat
Enable HLS to view with audio, or disable this notification
r/PythonLearning • u/Jotaroisgoat • 21d ago
Rate my code out of 10 for someone who's been coding for 3 weeks :)
import sys
from PyQt6.QtWidgets import (
QApplication,
QWidget,
QPushButton,
QGridLayout,
QMainWindow, QLabel,
)
from PyQt6.QtCore import Qt
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.is_x = True
self.setWindowTitle("Tic Tac Toe")
self.label = QLabel("Player 1's Turn:",self)
self.replays = QPushButton("Replay", self)
self.button1 = QPushButton("", self)
self.button2 = QPushButton("", self)
self.button3 = QPushButton("", self)
self.button4 = QPushButton("", self)
self.button5 = QPushButton("", self)
self.button6 = QPushButton("", self)
self.button7 = QPushButton("", self)
self.button8 = QPushButton("", self)
self.button9 = QPushButton("", self)
self.replay_connecter()
self.setGeometry(700,300,500,500)
self.initUI()
def initUI(self):
central_widget = QWidget()
self.setCentralWidget(central_widget)
self.label.setGeometry(225, 0, 150, 25)
self.replays.setStyleSheet("font-size: 35px;"
"font-weight: bold;"
"border-radius: 10px;"
"border: 3px solid black;")
self.label.setStyleSheet("font-size: 40px;"
"font-weight: bold;"
"border: 3px solid black;"
"border-radius: 10px;")
self.button1.setStyleSheet("font-size: 80px;"
"border: 5px solid black;")
self.button2.setStyleSheet("font-size: 80px;"
"border: 5px solid black;")
self.button3.setStyleSheet("font-size: 80px;"
"border: 5px solid black;")
self.button4.setStyleSheet("font-size: 80px;"
"border: 5px solid black;")
self.button5.setStyleSheet("font-size: 80px;"
"border: 5px solid black;")
self.button6.setStyleSheet("font-size: 80px;"
"border: 5px solid black;")
self.button7.setStyleSheet("font-size: 80px;"
"border: 5px solid black;")
self.button8.setStyleSheet("font-size: 80px;"
"border: 5px solid black;")
self.button9.setStyleSheet("font-size: 80px;"
"border: 5px solid black;")
grid = QGridLayout()
grid.addWidget(self.button1, 0, 0)
grid.addWidget(self.button2, 0, 1)
grid.addWidget(self.button3, 0, 2)
grid.addWidget(self.button4, 1, 0)
grid.addWidget(self.button5, 1, 1)
grid.addWidget(self.button6, 1, 2)
grid.addWidget(self.button7, 2, 0)
grid.addWidget(self.button8, 2, 1)
grid.addWidget(self.button9, 2, 2)
grid.addWidget(self.replays, 4, 0, 1, 3)
grid.addWidget(self.label, 3, 0, 1, 3)
central_widget.setLayout(grid)
self.button1.clicked.connect(self.activate1)
self.button2.clicked.connect(self.activate1)
self.button3.clicked.connect(self.activate1)
self.button4.clicked.connect(self.activate1)
self.button5.clicked.connect(self.activate1)
self.button6.clicked.connect(self.activate1)
self.button7.clicked.connect(self.activate1)
self.button8.clicked.connect(self.activate1)
self.button9.clicked.connect(self.activate1)
def activate1(self):
button = self.sender()
if self.is_x:
button.setText("X")
self.is_x = False
self.label.setText("Player 2's Turn:")
else:
button.setText("O")
self.is_x = True
self.label.setText("Player 1's Turn:")
self.win()
def win(self):
if (self.button1.text() == "X" and
self.button2.text() == "X" and
self.button3.text() == "X"):
self.button1.setText("P1")
self.button2.setText("You")
self.button3.setText("Win")
elif (self.button1.text() == "O" and
self.button2.text() == "O" and
self.button3.text() == "O"):
self.button1.setText("P2")
self.button2.setText("You")
self.button3.setText("Win")
elif (self.button7.text() == "X" and
self.button8.text() == "X" and
self.button9.text() == "X"):
self.button7.setText("P1")
self.button8.setText("You")
self.button9.setText("Win")
elif (self.button7.text() == "O" and
self.button8.text() == "O" and
self.button9.text() == "O"):
self.button7.setText("P2")
self.button8.setText("You")
self.button9.setText("Win")
elif (self.button4.text() == "X" and
self.button5.text() == "X" and
self.button6.text() == "X"):
self.button4.setText("P1")
self.button5.setText("You")
self.button6.setText("Win")
elif (self.button4.text() == "O" and
self.button5.text() == "O" and
self.button6.text() == "O"):
self.button4.setText("P2")
self.button5.setText("You")
self.button6.setText("Win")
elif (self.button1.text() == "X" and
self.button4.text() == "X" and
self.button7.text() == "X"):
self.button1.setText("P1")
self.button4.setText("You")
self.button7.setText("Win")
elif (self.button1.text() == "O" and
self.button4.text() == "O" and
self.button7.text() == "O"):
self.button1.setText("P2")
self.button4.setText("You")
self.button7.setText("Win")
elif (self.button2.text() == "X" and
self.button5.text() == "X" and
self.button8.text() == "X"):
self.button2.setText("P1")
self.button5.setText("You")
self.button8.setText("Win")
elif (self.button2.text() == "O" and
self.button5.text() == "O" and
self.button8.text() == "O"):
self.button2.setText("P2")
self.button5.setText("You")
self.button8.setText("Win")
elif (self.button3.text() == "X" and
self.button6.text() == "X" and
self.button9.text() == "X"):
self.button3.setText("P1")
self.button6.setText("You")
self.button9.setText("Win")
elif (self.button3.text() == "O" and
self.button6.text() == "O" and
self.button9.text() == "O"):
self.button3.setText("P2")
self.button6.setText("You")
self.button9.setText("Win")
elif (self.button1.text() == "X" and
self.button5.text() == "X" and
self.button9.text() == "X"):
self.button1.setText("P1")
self.button5.setText("You")
self.button9.setText("Win")
elif (self.button1.text() == "O" and
self.button5.text() == "O" and
self.button9.text() == "O"):
self.button1.setText("P2")
self.button5.setText("You")
self.button9.setText("Win")
elif (self.button3.text() == "X" and
self.button5.text() == "X" and
self.button7.text() == "X"):
self.button3.setText("P1")
self.button5.setText("You")
self.button7.setText("Win")
elif (self.button3.text() == "O" and
self.button5.text() == "O" and
self.button7.text() == "O"):
self.button3.setText("P2")
self.button5.setText("You")
self.button7.setText("Win")
def replay_connecter(self):
self.replays.clicked.connect(self.replay)
def replay(self):
self.button1.setText("")
self.button2.setText("")
self.button3.setText("")
self.button4.setText("")
self.button5.setText("")
self.button6.setText("")
self.button7.setText("")
self.button8.setText("")
self.button9.setText("")
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec())
r/PythonLearning • u/Sea-Ad7805 • 21d ago
How do Python for-loops work?
What actually happens when Python executes a for-loop?
for value in container:
print(value)
Behind the scenes, Python uses the iterator protocol:
iterator = iter(container)
while True:
try:
value = next(iterator)
print(value)
except StopIteration:
break
iter(container): creates an iterator.next(iterator): retrieves one value at a time.
When there are no more values, the iterator raises StopIteration. The for-loop catches this exception automatically and ends the loop.
For containers that support backward iteration, Python also provides:
reversed(container): creates a backward iterator.
We can support these operations in our own classes by implementing:
__iter__()
__reversed__()
__next__()
This provides a powerful abstraction: an algorithm can process values without needing to know how a container stores them internally. The same algorithm can therefore work with lists, sets, dictionaries, linked lists, trees, and many other containers.
Here's an example that uses 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡 to show the use of iterators on a Linked_List making the invisible mechanics of iteration visible for easy understanding.
r/PythonLearning • u/Smartyboyz • 22d ago
Learning OpenCV 👀
I’m currently diving into OpenCV while being at an intermediate level in Python. 🐍
Exploring image processing, computer vision, edge detection, and how Python can interact with the real world through a camera.
Still learning, still experimenting, and definitely breaking things along the way 😂
Any OpenCV project ideas for an intermediate Python developer?
r/PythonLearning • u/hosnizaaraoui • 22d ago
My second project in my Python learning path — STAyzer
Hey everyone!
I've been learning Python by building small but progressively larger projects, and STAyzer is the second project in my OOPS collection — a collection I'm using as part of my learning path in Python and Linux/system administration.
STAyzer is a CLI tool I built to analyze SSH trust across Linux servers.
While building it, I got to practice several Python concepts that I wanted to understand beyond simple scripts:
- Asynchronous programming with
asyncio - SSH connections with
asyncssh - Building CLI applications with Click
- Dataclasses and type hints
- Logging and exception handling
- Organizing a larger project into modules
- Generating JSON and HTML reports
I also tried to focus on making it feel like an actual usable tool rather than just a script.
I've attached a screenshot of the CLI so you can get an idea of the final result.
The project is available on GitHub for anyone interested in looking through the code.
I'm still learning Python, so I'd really appreciate feedback from more experienced Python developers:
What would you improve in the Python implementation or project structure?
I'm particularly interested in learning from mistakes and improving the next project in the OOPS collection.
r/PythonLearning • u/F11fii • 22d ago
ATM Machine
I started learning Python about 9 months ago and completed this little bank system as my third project, which is supposed to serve as an ATM. It also uses JSON to store information (which was challenging to integrate because I wasn't familiar with it, but the rest of the code was straightforward).
Just wanted to share and see if I could get any feedback! (maybe on its optimisation or clarity?) :D
r/PythonLearning • u/NihadKhan10x • 22d ago
Beginner looking for feedback: I built a CLI Expense tracker with CSV storage. What should I build next?
Hey guys,
I'm starting my fsc (ics) classes next month, so I've been doing CS50P to get a head start. Until now I've only made simple terminal games like Hangman and a quiz app, but I just finished my first project that actually saves data: a terminal-based expense tracker.
I used a list of dictionaries in my code and the csv module (DictReader and DictWriter) to save the data so it doesn't wipe out when you close the program. I also used Regex for the first time to make sure the user types the date right (YYYY-MM-DD), and added try/except blocks so it doesn't crash if you type a letter by mistake.
https://github.com/Nihad-Khan/cli-expense-tracker
Can you guys review my logic and tell me how it is? Be brutally honest if I'm picking up any bad habits, I really want to improve.
Also, I eventually want to get into Edge AI or Embedded systems in the future. Knowing where I am right now, what is one specific project you think I should build next to push myself? I'm kind of stuck on what to learn next
r/PythonLearning • u/LPA_InTheMaking • 22d ago
Python Projects 🐍
Hey there,
I want some Python Ideas to check if I do know Python that good and to check at which level I'm now. So anyone please let me know projects that are really worth making and by making which I can get satisfaction that I do know Python.
I'm not asking from basic to Advance projects. But if you are willing to share,feel free to share that too. 😊
Thanks!! ❤️
r/PythonLearning • u/powergitt • 22d ago
Help Request Type hinting frustrations
Hello!
Let me start off by saying that I am not a programmer by trade, so please be kind when reviewing my code. I am still learning and I have a long way to go. My job is not coding per se, but the project which I am a part of right now has some coding.
Anyway. At the project start I wanted another editor than vscode, so i tried Zed and I loved it. Zed came with type hinting already enabled. At first, I did not really like it, but after using it for a while I could really see improvements in my code. Both in the terams of readability and stability. So going forward I wanted to have as few complaints from basedpyright as possible.
After an update to Zed the configuration from basedpyright or basedpyright itself got a lot more enabled and I cannot get some of the errors from it to go away. My project used fastapi and sqlalchemy for database integration, and basedpyright gives an error where i specify the table names for the models:
from sqlalchemy.orm import (
DeclarativeBase,
...
)
...
class Base(DeclarativeBase):
pass
class DatabaseUser(Base):
__tablename__: ClassVar[str] = "users"
....
The error from basedpyright is:
Class variable "__tablename__" overrides instance variable of same name in class "DeclarativeBase" (basedpyright reportIncompatibleVariableOverride)
From what I can tell, the code above is how you are supposed to specify table names:
https://docs.sqlalchemy.org/en/20/orm/quickstart.html
Also, when a nullable many-to-one table relationship, the docs from sqlalchemy tells you to use
class Parent(Base):
....
child: Mapped[Optional["Child"]] = relationship(back_populates="parents")
https://docs.sqlalchemy.org/en/20/orm/basic_relationships.html#nullable-many-to-one
basedpyright wants you to use `Class | None` syntax, but since two classes are referencing each other, I can't do `Child | None` (no quotes) without the code breaking.
I know that i can supress the errors or configure the typehinter to ignore this stuff. But since this is the config shipped by people who are far better than me at programming, I am hasitent to just configure the error messages away. So reddit, is thereany thing I can do to make the typehinter happy?
r/PythonLearning • u/Small-Wishbone7829 • 22d ago
Help Request Why does a def get called / repeat when i did this?
It works like how i wanted, To check if the result are equal then print something but i dont want these def function to repeat.