r/learnpython • • 33m ago

Python 3.8.10 Broken on vista

• Upvotes

i tried install python in vista and it mid freeze in the instalation and i even use the repair tool in the installer but i keeped having the error "The Procedure entry point GetActiveProcessor could not be located in the dinamic link library KERNEL32.dll" and then a Python has stoped working, something weird here is why is it calling kernel32.dll? and i do not expet support since this is a outdated version but in windows 7 starter (same pc) it worked fine, i dont know if this is else becuse im using an modified version of vista (Vienna) or is else something to do with 3.8.10 in vista


r/learnpython • • 1h ago

I need some help

• Upvotes

I want to learn python but all of the online tutorials just tell me how to make a certain game but i want to learn how it works so if anyone can help me with this please let me know


r/learnpython • • 2h ago

Need help with a calculator project

2 Upvotes

new to python, Im making a calculator but when i try to make the code be able to handle a word without crashing it just doesnt work, it just goes and ask for the operator without restarting the loop, tried ai to fix it and explain it to me but didnt do nothing.

num1 = None
num2 = None
result = None


while num1 == None or num2 == None:
    try:
        num1 = float(input("Enter first number: "))
    
    except ValueError:
        print("must enter a valid number")
        num1 = None
        continue


    try:
        num2 = float(input("enter second number"))


    except ValueError:
        print("must enter a valid number")
        num2 = None
        continue
    operator = input("Enter operation (+, -, *, /)")


    if operator == "+":
        result = (num1 + num2)


    elif operator == "-":
        result = (num1 - num2)


    elif operator == "*":
        result = (num1 * num2)


    elif operator == "/" and num2 == 0:
        result = ("cant divide by zero")


    elif operator == "/" and num2 != 0:
        result = (num1 / num2)


    else:
        result = ("Invalid operator")


    if result == float or int:
        print(result)
        num1 = None
        num2 = Nonenum1 = None
num2 = None
result = None


while num1 == None or num2 == None:
    try:
        num1 = float(input("Enter first number: "))
    
    except ValueError:
        print("must enter a valid number")
        num1 = None
        continue


    try:
        num2 = float(input("enter second number"))


    except ValueError:
        print("must enter a valid number")
        num2 = None
        continue
    operator = input("Enter operation (+, -, *, /)")


    if operator == "+":
        result = (num1 + num2)


    elif operator == "-":
        result = (num1 - num2)


    elif operator == "*":
        result = (num1 * num2)


    elif operator == "/" and num2 == 0:
        result = ("cant divide by zero")


    elif operator == "/" and num2 != 0:
        result = (num1 / num2)


    else:
        result = ("Invalid operator")


    if result == float or int:
        print(result)
        num1 = None
        num2 = None

r/learnpython • • 3h ago

requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

1 Upvotes
import requests


# Add ?format=j1 to get a proper JSON response
url = "https://wttr.in"
response = requests.get(url)
data = response.json()


# This structure matches the j1 JSON format returned by wttr.in
current_temp = data['current_condition'][0]['temp_C']
print(
f
"Current temperature: {current_temp}°C")

I keep getting this exact SAME error whenever I work with public API's. I save the new codes in the files.

r/learnpython • • 4h ago

Looking for a coding buddy

1 Upvotes

Hey everyone!

I’m looking for a coding buddy who’s also taking 100 Days of Code: The Complete Python Pro Bootcamp by Dr. Angela Yu on Udemy.

I’m just starting with Day 1 and would love to connect with someone taking the same course so we can learn together throughout this 100-day journey.

The goal is to keep each other motivated and accountable, share our progress, discuss what we’ve learned, help each other when we get stuck, and celebrate our little wins along the way.

It would be great to have someone who’s also a beginner, but anyone taking the same course is welcome! No pressure to be an expert — we’re here to learn and improve together.

If you’re taking the same course, feel free to comment or send me a message. Let’s keep each other motivated and complete these 100 days together!

Happy coding!


r/learnpython • • 11h ago

dynamic import module path hack in pytest

3 Upvotes

In order to validate (using pytest) a python module which is not in my path or relative folders, I want to hack the import path.

I'm wondering what alternatives there are to doing a PYTHONPATH hack. I could use https://docs.pytest.org/en/7.1.x/reference/reference.html#confval-pythonpath, but that applies to the entire session as I understand it. And I only want to change one suite, so I am writing a quick fixture that will roughly look like (hard-coded for simplicity) @pytest.fixture(scope="function") def modules_path(): old_path = sys.path extra_path= os.path.abspath("c:/otherpath/other") # replace constant with a func sys.path.insert(0, extra_path) yield extra_path sys.path = old_path I've always felt there was a better way to do import path hacks that nobody had ever told me about. Or is this @fixture approach not as evil as I assumed it was, and was merely biased by painful memories whenever I did use it. Alternatives?


r/learnpython • • 12h ago

What would be the best course of action if u were flagged for cheating?(PCEP)

0 Upvotes

For context: i started the pcep test while forgetting that it was still connected to a 2nd monitor and my cursor flew into the 2nd screen which got me flagged for cheating. What would be the best course of action right now for me?


r/learnpython • • 13h ago

Dsa in python

0 Upvotes

Hey everyone! I'm planning to learn Data Structures and Algorithms using Python.

Is it worth learning DSA with Python for placements, coding interviews, and future software engineering jobs? Or is it better to learn DSA using C++ or Java?

For those who have experience, which language would you recommend and why?


r/learnpython • • 14h ago

Python language tutorial

0 Upvotes

Hey guys, i wanna learn Python from scratch. I dont have any prior knowledge about any coding language. Please tell me from where should i learn. Mainly for Computational modelling, SciPy,NumPy etc


r/learnpython • • 14h ago

Best laptop to get

0 Upvotes

What are the best Windows laptops I can get for AI development, machine learning, and video editing? I’m looking for a laptop that can handle demanding tasks smoothly and is suitable for long-term use. Please recommend the best options based on performance, specifications, . I’d really appreciate your help!


r/learnpython • • 18h ago

Can any of you rate my codewars question

0 Upvotes

It's one i've been thinking about for a while and i'd love to know all of your opinions about it! https://www.codewars.com/kata/6ad8699fccb2dbf6de41f760/python


r/learnpython • • 19h ago

How To Compile .PY Online

0 Upvotes

i have a .py file i want to compile to .exe online but no idea how to do this

and i don't want to install python on my computer just to compil


r/learnpython • • 20h ago

can you get an executable in python without using third part libraries?

0 Upvotes

In c++ I have object files but can I get an executable in python?


r/learnpython • • 22h ago

Issue during library installation

1 Upvotes

Recently, I got back into Python, so I decided to review some concepts I had forgotten by solving one Project Euler problem per day.

However, when I got to Problem 3 (Largest Prime Factor), I decided to use a library to check whether a number is prime. Since I had uninstalled Python when I stopped studying it, I had to install Python 3.15.

When I first tried to install the library, the terminal said that it didn't recognize pip. I managed to get it working by using python -m pip, and the installation seemed to work. However, when I ran my code, Python still couldn't recognize the library.

The next day, while solving Problem 4 (Largest Palindrome Product), I decided to use NumPy and np.arange() instead of range(), but the same thing happened: the installation appeared to work, but when I ran my code, Python couldn't find the library.

I tried uninstalling and reinstalling Python, but the problem persisted.

In these particular cases, I could still solve the problems without those libraries, but eventually, I'll need packages like pandas, Tkinter, and others, so I'd like to figure out what's going wrong.

If anyone knows how to fix this, I'd really appreciate the help!

Thanks in advance!


r/learnpython • • 23h ago

Can someone explain the importance of this?

1 Upvotes

I saw this link online on social media with a reminder to update dependencies but I don’t really understand it, how I am affected, and how I can address this.

Link here: https://github.com/certifi/python-certifi/security/advisories/GHSA-6q48-6c7w-9gw2

Here’s the text:

Removal of emSign root cerificate

Affected versions
>=2019.03.09

Description
Certifi 2026.10.18 removes root certificates from "emSign" from the root store. These root certificates have intermediates which have been revoked due to key compromise.
A compromised key for a certificate authority can be used to issue certificates to enable MITM attacks.


r/learnpython • • 1d ago

How important is python with Spyder IDE to computer engineering major

0 Upvotes

Doing horribly in beginners Python and want to know how important it is or is Java better to start off with


r/learnpython • • 1d ago

Need help with building tests and understanding OOP design patterns

3 Upvotes

I am a post-bacc student currently in a Python for Web API online course. We just wrapped up our calculator application unit, where we learned how to build comprehensive dynamic tests using OOP design patterns. However, I finished the unit a lot more lost than when I started. Building parameterized tests still puzzles me, especially whenever I'm building the majority of a test from scratch rather than fixing minor errors in the code. Even when I do use AI to help me work through my assignments, none of it really sticks. Most of the time, I feel like I'm copying and pasting code whenever mine is incorrect and not really learning.

What are resources that you all would recommend for learning how to build application tests and files with OOP concepts? Any online resources with interactive, hands-on lessons would be greatly appreciated.


r/learnpython • • 1d ago

Gradient Descent from scratch

0 Upvotes

Hello there. I’ve implemented gradient descent from scratch, without using any libraries, and I’m looking for some feedback. Could you point out any errors or shortcomings? I’d welcome any constructive criticism.

GitHub: https://github.com/miroslav-fedechkin/gradient-descent-from-scratch


r/learnpython • • 1d ago

Keyboard input to Razer Hydra input script in FreePie (or something else)

2 Upvotes

now if this isn't the right place for dumb stupid stupid dumb tech favours shove me off to another r/

basically I was thinking "what if I could play tf2 with Wii remotes because tf2 has razer hydra support, so if you just translated the Wii remote inputs into razer ones then it would work in tf2"

I've already got a program called gunmote that can translate Wiimote inputs to mouse+keyboard so I thought you could just translate the m+k inputs to hydra inputs

btw the reason I'm not using steam input is because tf2 has this weird aiming for the hydra https://youtu.be/MYAjBFhzgIU that's suspiciously similar to the Wii era aim style

so um ye


r/learnpython • • 1d ago

Help learning python fast (also ai discussion)

0 Upvotes

I’m a university student using ai and behind in class and need help learning python fast, I can read it decently well and explain what stuff says but when I need to write it I get stuck and stare at the screen until my eyes blur, also I had an assignment from my professor where it is 25% of my grade and taking me to long to do, due in a day and only like half done with it and needed help with multiple steps previously. Anyone have ideas on how to speed up how long it takes and fix the multiple errors in it? I’m at the point that I have to use ai to help out a lot but professors are strict about it in this class and check for it but I’m trying to humanize some of it, I need to at least get the assignment turned in and buy some time before the next big one to learn more because I can’t afford another semester of college since I won’t get scholarship to cover it. So I’ve been typing it out into visual code and not copying and pasting and having it typed like I normally do while taking each segment and familiarizing with what it does and if I don’t know asking ai why it is there, anything that looks unfamiliar or weird I’ve been trying to figure out how to write it with what the class has been taught, not justing using ai and leaving it at that. I really just need to greatly increase output and rather not use ai so any help would be great, also if I do need to use ai is there a way to do it where I at least partially write the code after seeing what it gives besides basic editing for at least reinforcement experience? I’m also doing a lot of this is what I need what kind of function etc and give me examples of how to write it where a beginner can understand


r/learnpython • • 1d ago

La duda que tengo.

2 Upvotes

Hace no mucho decidí por mi cuenta aprender python de manera autodidacta y con cursos al menos con certificación o con instituciones que son reconocidas para ir a la universidad ya preparado. -Cualquiera puede buscar un curso y puede buscar una institucion que de videos para aprender como es el caso del MIT o Harvard que dan cursos gratis o videos enseñando solamente que no muchos averiguan- y mi pregunta es. Sirven esos cursos? Alguna recomendación? Y por último pero no menos importante... Porque dicen mucha gente que la programación o algo que tenga que ver con tecnología es para gente introvertida o "Virgen"? Entiendo que tu trabajo no será estar con muchas personas o tan siquiera con personas y estarás en una computadora. Y te puedo decir yo que soy la persona más -al menos a mi pensar- expresiva o sociable que hay al menos en mi grupo de amigos. Eso y que pues no me parezco en nada a lo que plantean o dicen las personas. Me han dicho que hasta parezco que estudio/practico otra cosa que eso.


r/learnpython • • 1d ago

I want to practice various algorithms using Python. Any recommended platforms?

15 Upvotes

It should include both code input and algorithm analysis.


r/learnpython • • 1d ago

Is it github problem or python problem?

0 Upvotes

So, i have been trying to learn python, sqlite and tkinter. After a lot of trouble and copying from AI i uploaded my python and sqlite only executable to github for all 3 os using github action.

Now, I am learning python and tkinter. I made a simple program which converts KG to gram and vice versa.

import tkinter as tk
# from tkinter import ttk
import ttkbootstrap as ttkimport tkinter as tk

These 3 are my only imports for now. and i am using:

root = ttk.Window(themename = 'darkly')
root.geometry("400x300")
root.title("Unit Converter")root = ttk.Window(themename = 'darkly')

other is just my code which i wrote form tutorials and documents.

The problem i am facing is that i cant seem to release the executable to github ( from github action ) at all.

I tried to learn how this works but i didnt find anywhere to actually learn so i just asked AI and after a lot of back and forth there are still some problems.. Is there somewhere i can learn how i can do this? I prefer video tutorial.

I will comment my program and what AI told me the problem was below. Please someone do help me.


r/learnpython • • 1d ago

Telethon 1.45.0 suddenly stopped delivering Telegram login codes — it was working perfectly until last week

0 Upvotes

I'm experiencing a frustrating issue with Telethon in Google Colab, and I'm hoping someone can help me identify the root cause.

Everything was working perfectly until last week. I was using the same login workflow, and Telegram was successfully delivering login codes to the official Telegram service chat in my account. I could authenticate with Telethon without any problems.

Suddenly, the login codes stopped arriving, even though Telethon reports that the request was successful.

Environment

  • Python: 3.13.16
  • Telethon: 1.45.0
  • Platform: Google Colab
  • Authentication: Phone number using API_ID and API_HASH
  • Protobuf: 7.3.1 (I'm not sure whether it's relevant.)

What happens exactly?

  1. Connecting to Telegram's servers works successfully.
  2. client.is_user_authorized() returns False for a new session.
  3. client.send_code_request(phone) completes without raising an exception.
  4. Telegram returns the following response: SentCodeTypeApp(length=5)
  5. No login code arrives in my Telegram account, even though this exact workflow was working normally until last week.
  6. I can still log in to my.telegram.org using the same phone number, and the login code arrives successfully in Telegram Desktop.

What have I tried?

I've already tried several troubleshooting steps, but nothing has resolved the issue. The connection to Telegram's servers works, and the code request is accepted, yet the login code never arrives.

My questions

  • Has there been any recent change to the Telegram API or login-code delivery mechanism within the past week?
  • Is there a known issue with Telethon 1.45.0, Python 3.13, or Google Colab that could explain this sudden behavior?
  • Does SentCodeTypeApp confirm that Telegram actually delivered the code, or does it only indicate the intended delivery method?
  • How can I diagnose the problem and identify the root cause without repeatedly requesting codes or randomly changing my API credentials?

The most important detail is that the same code and workflow were working perfectly until last week, and then the login codes suddenly stopped arriving without any intentional changes on my part.

Has anyone experienced a similar issue recently? Is there a known bug, API change, or authentication-related restriction that could explain this behavior?

Any suggestions or technical guidance would be greatly appreciated.

Thank you!


r/learnpython • • 1d ago

My first go at Python

0 Upvotes

So I have been learning Python for around 4 hours and I just finished this and I would want to know if it's good or if it's just okay.

again = "yes"

while again == "yes":

print("create your character: ")

# sex

sex = input("sex? ").strip().lower()

while sex not in ['male', 'female']:

sex = input("try again, you misspelled male or female: ").strip().lower()

if sex == "male":

print("hello boyyy")

else:

print("helloooo girl")

# age

age = int(input("what is your age: "))

while age < 18:

age = int(input("try again "))

# name

name = input("what is your name: ").lower().strip()

print("hello " + name)

# height

height = int(input("height in cm "))

if height >= 180:

print("tall person eh?")

else:

print("nice.")

print("next questions")

# build

build = input("what is your build. skinny. fat. muscular. ").lower().strip()

while build not in ['skinny', 'muscular', 'fat']:

build = input("try again. that was not an option ").lower().strip()

if build == "skinny":

print("interesting choice... " + name)

elif build == "muscular":

print("perfect choice especially for a man")

elif build == "fat":

print("HAHAHA FATSO HAHAHA")

# stats

print('____')

print(' ')

print('stats for: ' + name)

print('age:', age)

print('height:', height)

print('sex:', sex)

print('build:', build)

print('____')

again = input("create another character? Yes/No: ").strip().lower()

while again not in ['yes', 'no']:

again = input("answer using Yes or No: ").strip().lower()

print("Goodbye!")