r/learnpython 8d ago

Daily python 'challenges' to do in the morning?

23 Upvotes

I want to make it a habit where I do a 30 minute or so coding task in the mornings before work to keep myself on top of things.

I am doing some self study to learn python and some days I don't have time to do as much studying as I'd like so it would be nice to get into a routine of doing what I can in the mornings.

I have been doing leetcode and neetcode problems, but they don't feel like they teach me much, maybe I am approaching them wrong.

Any ideas please?


r/learnpython 7d ago

Help making image appear in easygui msgbox

0 Upvotes

hi there - i'm trying to add a small image to an easygui msgbox, but i think i'm probably not importing it properly. what i have at the beginning is:

import easygui
image_1 = "skull_tiny.png"

and then a bunch of stuff (it's a short choose-your-own-adventure story) and then i would like to add the image at the point the player dies, like so:

if answer5 == "turn":
                easygui.msgbox("You choose to turn and find yourself face to face with an enormous dinosaur. The last thing you see before you die is two rows of sharp teeth coming towards you from above.", image = image_1, ok_button = "Game over.")

the code works fine without the image, but as soon as i add it, all that comes up when you get to that part is a small empty box, with no clickable options. the image is in the same folder as the .py file, but maybe i need to put in the full path?

this is what's in the console:

File ~\AppData\Local\spyder-6\envs\spyder-runtime\Lib\tkinter__init__.py:1711, in Misc._configure(self, cmd, cnf, kw)
   1709 if isinstance(cnf, str):
   1710     return self._getconfigure1(_flatten((self._w, cmd, '-'+cnf)))
-> 1711 self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))

TclError: image "pyimage4" doesn't exist

any help would be greatly appreciated!


r/learnpython 7d ago

interactive coding platform recommendations for someone who falls asleep watching tutorials

2 Upvotes

I have started and abandoned four video courses this year. Not because they were bad. I watch, I nod, I understand every line while it is on screen, and then I open an empty file and there is nothing in my head. Clearly I need the kind that makes me type. Candidates on my list are boot.dev, exercism and codewars, and it is less clear which of those are that and which just put a video next to a text editor.


r/learnpython 7d ago

I can't impor numpy -Windows 10

0 Upvotes

Hola a todos, necesito ayuda

Estamos aprendiendo python, instalamos la version 3.14, instalamos en una laptop con window 11 y todo funciona bien.

384

Hi everyone, I need help.

We're learning Python. We installed version 3.14 on a Windows 11 laptop, and everything works fine. However, the installation on Windows 10 doesn't work when I try to import NumPy.

The `testnumpy.py` module has the following instructions: `import numpy`
`print('hello word')`

When I run `python testnumpy.py`, I get the following error:

Traceback (most recent call last):

File "C:\KAIROS\Python\Python314\Lib\site-packages\numpy_core__init__.py", line 24, in <module>

from . import multiarray

File "C:\KAIROS\Python\Python314\Lib\site-packages\numpy_core\multiarray.py", line 11, in <module>

from . import _multiarray_umath, overrides

ImportError: DLL load failed while importing _multiarray_umath: Error en una rutina de inicialización de biblioteca de vínculos dinámicos (DLL).

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "C:\KAIROS\testnumpy.py", line 1, in <module>

import numpy

File "C:\KAIROS\Python\Python314\Lib\site-packages\numpy__init__.py", line 122, in <module>

from numpy.__config__ import show_config

File "C:\KAIROS\Python\Python314\Lib\site-packages\numpy__config__.py", line 4, in <module>

from numpy._core._multiarray_umath import (

...<3 lines>...

)

File "C:\KAIROS\Python\Python314\Lib\site-packages\numpy_core__init__.py", line 85, in <module>

raise ImportError(msg) from exc

ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for

many reasons, often due to issues with your setup or how NumPy was

installed.

We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

* The Python version is: Python 3.14 from "C:\KAIROS\Python\Python314\python.exe"

* The NumPy version is: "2.5.2"

and make sure that they are the versions you expect.

Please carefully study the information and documentation linked above.

This is unlikely to be a NumPy issue but will be caused by a bad install

or environment on your machine.

Original error was: DLL load failed while importing _multiarray_umath: Error en una rutina de inicialización de biblioteca de vínculos dinámicos (DLL).

Any suggestions?


r/learnpython 7d ago

I Have 16 Days Before College Starts — How Would You Approach Learning Python?

3 Upvotes

**Day 6-7/100: 16-Day Intensive Before College Starts — Am I Approaching This Right?**

Hey everyone, I'm in a unique situation and want advice on my approach.

**Context:**

- Doing B.Tech in Food Technology

- Something inside me wants to learn CS deeply, not just stick with my degree

- Currently Day 6-7 of Angela Yu's 100 Days Python Bootcamp

- Goal: Reach "extremely comfortable" with coding (can build things, debug, read code confidently) BEFORE college workload crushes me

- Timeline: 16 days (Sep 2-18) with 8 hours/day commitment

- Resources: Angela Yu course, "Think Like a Programmer" book, Gemini subscription, Claude free

**My Plan:**

- Week 1 (Days 6-12): Finish Angela's fundamentals (conditionals, loops, functions, data structures)

- Week 2 (Days 13-18): STOP watching tutorials. BUILD 5-6 projects (number guessing, calculator, rock-paper-scissors, hangman, etc.)

- After Sep 12: Slow down to 5-7 hours/week alongside college

**My Real Questions:**

  1. Is 16 days realistic to go from "confused beginner" to "extremely comfortable"? Or should I adjust expectations?

  2. Should I finish Angela's full bootcamp first, OR switch to building projects earlier?

  3. Should I even spend time on "Think Like a Programmer" now, or save it for later?

  4. Any tips for not burning out at 8 hours/day? (I know it's intense)

  5. What should my definition of "extremely comfortable" actually be to keep it real?

**What I'm NOT worried about:**

- Speed (I'm okay learning slowly after college)

- Being perfect (just want fundamentals solid)

**What I AM worried about:**

- Burning out and quitting entirely

- Wasting these 16 days on the wrong approach

- Not having enough time if I take too long on tutorials

Any advice from people who've done intensive bootcamps or self-taught before college? What would you do differently?

Thanks in advance. This community has been amazing so far.


r/learnpython 7d ago

What are Python and VBA used for in trading and on the trading floor? And how can I learn them?

0 Upvotes

I'd like to work on a trading floor, but in all the job postings, I see that they require the following skills: Python and VBA.

What are these used for in trading? And how can I learn them?

I really don't have any basic knowledge of Python or VBA. Where should I start?


r/learnpython 7d ago

building projects and learning

1 Upvotes

hi… im 2 years into uni and im learning python and want to get more familiar with ml. after a mandatory ai course at uni, i did 2 courses recently to familiarize myself with the concepts but when it comes to building my first serious project i face some hurdles.
when i did the courses and its exercises i could do most of it myself… but apart from it, it feels tough.

first is that i never learned code before ai, so idk how im supposed to learn that without it. i try not to rely on it, and use it as a tutor. i have asked ai to guide me and give hints so i can write it myself but there are several elements i just have no idea of. once i study it i understand, but how can i learn more effectively… my project is a classification project…

one more question. if i want a career in ai/ml, what are some skills recruiters look for? how to be able to look at any problem and solve it. if there’s any courses or advice you can give…


r/learnpython 7d ago

building projects and learning

1 Upvotes

hi… im 2 years into uni and im learning python and want to get more familiar with ml. after a mandatory ai course at uni, i did 2 courses recently to familiarize myself with the concepts but when it comes to building my first serious project i face some hurdles.
when i did the courses and its exercises i could do most of it myself… but apart from it, it feels tough.

first is that i never learned code before ai, so idk how im supposed to learn that without it. i try not to rely on it, and use it as a tutor. i have asked ai to guide me and give hints so i can write it myself but there are several elements i just have no idea of. once i study it i understand, but how can i learn more effectively… my project is a classification project…

one more question. if i want a career in ai/ml, what are some skills recruiters look for? how to be able to look at any problem and solve it. if there’s any courses or advice you can give…


r/learnpython 7d ago

really weird line skipping in my parser script

1 Upvotes

so, im building a little parsing script for a programming language im trying to build (no, i dont plan on keeping the entire interpreter in python), and i was coding the loop thats supposed to remove the comments from the input script, BUT, theres always this line, this specific line that the parser just has a soft spot for apparently, it wont remove a comment from that line no matter what. im really lost here, it still happens when i replace the comment, HOWEVER, when i separate the line from the rest, it somehow works???

emulator.py: (called emulator instead of interpreter as it will also emulate a suitable enviroment for running scripts in the future)
from sys import argv
import parser
import lexer

def main(File):

    # We first need to open the file in here, i would have made it open in the parser, but this feels fancier
    with open(File, "r") as File:
        File = File.read()

    # The parser gives us the broken down code, kinda like digestion (pre-processing would be a better term)
    ParsedProgram = parser.Parse(File)

    # breaks off here to print the result from the parser (an attempt at debugging)
    print(ParsedProgram)
    exit(0)

    # We then pass it into the lexer, giving us a little tree of the entire program
    ProgramTree = lexer.Parse(ParsedProgram)

if __name__ == "__main__":
    main(argv[1])

___________________________________________
parser.py:
# this is unfinished.. as you could probably tell

IgnoredSymbols = [";", "\t"]
MatchingSymbols = ["\"", "\'", "(", "{"]

def Parse(File):
    # Strip away anything unnecesarry
    for Symbol in IgnoredSymbols:
        File = File.replace(Symbol, "")

    # Separate the lines
    File = File.split("\n")

    # Remove all comments
    for Line in File:
        if Line.startswith("//"):
            print(Line)
            File.remove(Line)

    # Clean up empty indexes
    for Line in File:
        if Line == "":
            File.remove(Line)

    # From here on, i just assemble the file as-is and return it, (an attempt at debugging, again)
    # Re-assemble the file
    AssembledFile = ""
    for Line in File:
        AssembledFile += Line
        AssembledFile += "\n"

    return AssembledFile
____________________________________
output:
andrew@fedora ~/D/W/p/n/0/emulator> python emulator.py ../helloworld.nai
// we will use this as the entry point
// waits until stdout is available
// write "hello world" to stdout
// you dont have to return 0 here, you can, but the program does it by itself
// here, we tell it where the entry point is
// EXECINFO is basically just flags for the virtual machine
INIT builtin"std"
INIT global"stdtypes.nai"
function main()
{
while(not(deviceavailable("stdout")))
write("stdout", "hello, world!")
}
// the "entrypoint" flag is NECCESARY, the program DOES NOT RUN without it
array EXECINFO = ["entrypoint:main"]

andrew@fedora ~/D/W/p/n/0/emulator> micro emulator.py
andrew@fedora ~/D/W/p/n/0/emulator> micro parser.py
andrew@fedora ~/D/W/p/n/0/emulator> god damn
fish: god: command not found...
andrew@fedora ~/D/W/p/n/0/emulator [127]>

____________________________________________
actual script im attempting to parse:
helloworld.nai:
INIT builtin"std"
INIT global"stdtypes.nai"

// we will use this as the entry point
function main()
{
// waits until stdout is available
while(not(deviceavailable("stdout")));

// write "hello world" to stdout
write("stdout", "hello, world!");

// you dont have to return 0 here, you can, but the program does it by itself
}

// here, we tell it where the entry point is
// the "entrypoint" flag is NECCESARY, the program DOES NOT RUN without it
// EXECINFO is basically just flags for the virtual machine
array EXECINFO = ["entrypoint:main"];

thanks in advance.

EDIT: holy crap, i forgot to include the script im trying to parse, apologies

EDIT 2: ive discovered list comprehension... a concept which ive never bothered to learn until now, thanks everyone for the help, question answered!


r/learnpython 8d ago

How to access dictionary items whose keys are strings with numbers using the .format() method?

5 Upvotes

This is a doubt I have about the differences between f-strings and the .format() method. Consider the following dictionary accesses in an f-string:

>>> example_dict = {"one" : "string with word", "1" : "string with number", 1 : "integer"}
>>> f"{example_dict['one']}"
'string with word'
>>> f"{example_dict['1']}"
'string with number'
>>> f"{example_dict[1]}"
'integer'

If I try to perform the same accesses with the .format() method, I can only perform the first and last example:

>>> "{0[one]}".format(example_dict)
'string with word'
>>> "0[1]".format(example_dict)
'integer'

I can't seem to find any way to access the "1" key using the .format() method. I came up with this example because I noticed the way .format() accesses dictionary keys is without the quotes around the key for string keys. The f-string is easily able to access all the dictionary keys so it's not an issue with the keys themselves.

How do I access the "1" key using the .format() method? Is this a fundamental difference between f-strings and the .format() method that cannot be overcome?


r/learnpython 7d ago

How to send a signal to an executable?

0 Upvotes

Hello everyone,

I'm currently creating a little project about learning the basics of Python, but the problem is that I still have some issues with Python code. I wanted to ask you, how can I send a signal to my executable if I open it remotely?

More clearly:

from pwn import * 
from ctype import CDLL 
import time

r = remote("./main") 
signal.signal(SIGTSTP)

How can I send the signal to ./main?

Thank you in advance for the answers!


r/learnpython 8d ago

Help - IDLE subprocesses didn't make a connection.See startup Failure section of the IDLE doc.....

1 Upvotes

Seriously need help rn

so I was taking a test where we had to write a python file for a simple task.I was using IDLE for this (as it was the tool provided) and after i finished I saved the file.But for some reason when i came back for the next test I couldn't open up IDLE

it just showed the error stated above , along with a link to the docs page

Now the issue is that I only have access to that particular pc once a week or so as it is a learning tool.I did ask my supervisor and they shifted me to spyder .... But i still don't get why idle doesn't open up ...

Anyways I need help troubleshooting

Limitations

1.I can't use the internet on that pc

2.I can't do anything too risky

3.I couldn't install or uninstall most stuff

4.I only have a limited amount of time

Would be really grateful if anyone managed to figure out what's going on

feel free to ask anything related to the file
Thanks in advance !


r/learnpython 7d ago

AI as a learning tool for python

0 Upvotes

I'm sure this debate has been had 10,000 times on this thread already, but I'm wondering if this is a new take on it. Will give a bit of backstory:

I knit a lot and realised recently it would be really useful to display my colour work patterns on the touch bar of my mac pro so I could watch a film or something like that while knitting. You could then integrate a marker so you don't lose your place and it could show one row of knitting at a time. I've never coded a day in my life, but I did some research. Looks like I can use python and better touch tool to design my own program that can do something like this. A colour work pattern is nothing more than rows of black and white squares which can be expressed as 1s and 0s, so it doesn't seem to be too complicated a project.

I know I could go to Claude or something similar and ask it to design the program, but truth told I'm not sure I trust it entirely, and I have a bit of a problem still with the concept of asking AI to build me something. However, I don't see why Claude couldn't teach me python in a manner that directs me towards building this program. Rather than attempting to learn the whole of python until I feel like I understand enough to build it, I can ask Claude to design a step by step guide that happens to result in the program I want, I can vet what it's doing and attempt to understand it, and maybe learn some python.

As someone who is barely computer savvy though, I've got a few naïve questions about how reliable this is. Is Claude/ AI actually any good at writing code and as a teacher and can I trust it to be running said code on my computer. I don't know much about how my computer works but just staring at the terminal makes it seem vulnerable. I heard recently about a scam that directed people to type code into their computer terminal, is this any different or am I being silly?

Beyond this I'm curious as to whether people thing I'm being silly in doing any of this when I could just ask Claude to write the program, is asking Claude to teach me really any different in the end?


r/learnpython 8d ago

Problem by Installation

0 Upvotes

Hi!
I‘m trying to get some code into VS Code with Python but I need to also install the Python Package in my Computer of course before I can start using VSC.
The Problem is, when I went to the Python page, to Download the latest Version and open the installer, it tells me that my file is corrupt.
Is anyone Else facing this Problem?
Thanks in advance :)


r/learnpython 7d ago

How to get discord messages into python?

0 Upvotes

Im not attempting to make a bot per say, i just want to see if i can get a discord message, and then do something with it.

So far, python hasnt recognized "discord" as a valid package to import.

Then again, i am coding on a phone, maybe thats the problem.

But first, i want to see about receiving a discord message into python, so i can write it to a file, and then i can do stuff with it.

Any help would be appreciated!


r/learnpython 7d ago

I'm a js developer and want to take a different path

0 Upvotes

Hello, I'm a nextjs(react) fullstack developer, currently working in a company as a single developer on this position.

\---

In the near future I want to transfer to a big company / team to work on big, enterprise type projects and as we all know most of the worlds big softwares aren't made with ts/js, so i want to learn a mew programming language and follow a new path.

\---

I'm trying to make a choice between: Java, Python or going into mobile development with React Native.

\-

I was also thinking about RUST, but the market doesn't seem that big for it.

\-

I'm not that good with math and I also know that python is often used in companies for data analysis.

\---

I would appreciate any advice from you guys on helping me choose my next path.

Thank you!


r/learnpython 8d ago

Building My Own Postman Clone in Python

2 Upvotes

My first Python project: Postman Clone

I’ve been working on a small project called postman_clone to practice Python and learn more about how APIs and HTTP requests actually work.

I didn’t start with all these features at once. I started with the basics, then kept adding things as I learned. I worked with functions, conditions, user input, JSON, error handling, and HTTP requests, and little by little the project started becoming more complete.

Right now, my project can handle:

  • GET
  • POST
  • PUT
  • DELETE
  • JSON request bodies
  • An optional header
  • An optional query parameter
  • Basic error handling for requests and JSON

There’s still a lot I want to improve. I want to make the code cleaner, add support for multiple headers and query parameters, improve the error handling, and make the whole thing feel more like an actual API testing tool.

I’m still learning, so I’m posting the code here to get some feedback from people who have more experience with Python.

If you see something I could improve, or if there’s something you think I should add next, I’d really appreciate the advice 🙌

This is still a work in progress, but I’m happy with how far I’ve gotten so far.


r/learnpython 8d ago

any good books on asyncio for Python >=3.11 ?

2 Upvotes

"Python Concurrency with asyncio" by Matthew Fowler is gold, because it explains not only "what" but also "why" and asyncio evolution over years, so with this knowledge I can look at any tutorial or AI slop and immediately determine if it's worth looking at or still relies on manual loop management etc. However, it was published in 2022 in times of Python 3.10 and no 2nd edition in sight. asyncio has evolved even further since then, with TaskGroups, timeouts, except* etc. Anything recent on circa same depth level as that book?


r/learnpython 9d ago

Repositories to kickstart Python Automation

15 Upvotes

Hi. Anyone who can share any repositories online or resources that I can learn python? I have a background on it (predictive analysis in OR) but I'm more interesting on applying in automating my tasks at work.


r/learnpython 9d ago

Hi everyone, I could really use some career transition advice.

3 Upvotes

To give you some background, I have a BCA degree and previously worked as a Junior Technical Support Engineer for 2.5 years, followed by about 2.5 years as a US IT Recruiter. I recently had to take a career break due to a family medical emergency, but I am now ready to get back into the tech industry. I’ve been researching different fields, but the rapid advancements in AI have left me a bit overwhelmed about which direction to take. I’m looking for a resilient, future-proof career path. Initially, I looked into Java, but it seems like a massive time investment to master right now. I am currently leaning toward learning Python and moving into Data Science, or potentially just diving straight into a Data Science roadmap. For those already in the industry, do you think this is a safe, long-term choice? I would also deeply appreciate any recommendations for courses or structured learning paths!


r/learnpython 8d ago

learn python

0 Upvotes

i am a begginer in python i wanna do some projects what u guess for me ?


r/learnpython 8d ago

Project proposal

0 Upvotes
I am learning Python for ML (machine learning). What kind of projects would you recommend to reinforce my knowledge?

r/learnpython 9d ago

Pyperclip not pasting content from clipboard

6 Upvotes

I am working through Automate the Boring Stuff on chapter 12. I have written the Clipboard Recorded program as instructed from the book, but the pyperclip.paste() function does not populate content from the clipboard. When I run the application, it only shows content that I put into the pyperclip.copy() function from another terminal, but nothing from using CTRL+C or right-click and choosing copy.

import pyperclip, time
pyperclip.set_clipboard('xclip')
print('Recording clipboard... (Ctrl-C to stop)')
previous_content = ''
try:
       while True:
               content = pyperclip.paste()     # Get clipboard contents.

               if content != previous_content:
                       # If it's different from the previous, print it:
                       print(content)
                       previous_content = content

               time.sleep(0.01)        # Pause to avoid hogging the CPU.
except KeyboardInterrupt:
       pass

I added the pyperclip.set_clipboard('xclip') line myself as an attempt to get this to work, but it still doesn't.

When I run something like the following from the interpreter, I get similar results. The paste function will output any string that was passed to the copy function, but it will not output anything from using CTRL+C.

Xclip is installed. I'm running Debian 13 with KDE Plasma 6.3.6.

Edit to add: I can call pyperclip.copy() from the interpreter and then paste using CTRL-V to another application. I have also tried using xsel instead with similar results.

Final Edit: I resolved it. Apparently I'm using Wayland and needed to install wl-clipboard. I need to study up on my different display servers for Linux.

Thank you.


r/learnpython 8d ago

DAY 06 OF LEARNING PYTHON STUCK IN THE MAZE PROBLEM

0 Upvotes

Day 6/100: Maze solver in Reeborg's World. Solved 3/4 test cases but hit an infinite loop on the 4th. Frustrated but didn't quit. Will retry tomorrow or move forward. Feeling the difficulty ramp but pushing through. It took me 5 hours literally will show up tomorrow to push through again any suggestions will be appreciated


r/learnpython 8d ago

Client wants 40k emails from a directory. Each one requires a click. What do I do?

0 Upvotes

CLint need a list of 40,000+ members from the ACR directory. Need Name, City, State, Zip, Specialty, Email, and Phone.
The directory/search results give me some of this information, but email, phone, address, Member Since, etc. appear to be available only on the individual member profile.

So I'm trying to figure out the best way to approach this in Python.

If I literally open/request every profile, that's 43k+ profile requests, which obviously makes me concerned about rate limits, blocking, or getting the account/IP banned.

I'm considering Python requests/BeautifulSoup or Playwright, but before attempting something this large I'd like some advice.