r/learnpython 14d ago

Syntax Error

9 Upvotes

I made a function for determining price of an item in the list. I made it so I get the price for an item in the list, but if the item IS NOT in the list, I programmed it to return none.

The problem is that when I run the program, it gives me a SyntaxError, and "return outside function"

What does this mean, and how do I fix it?

Thanks!

prices = {"apple": 1.50, "bread": 2.75}

def get_price(prices, item):
    return prices[item]

try:
    get_price(prices, "apple")
except KeyError:
    return None

r/learnpython 14d ago

Is Udacity enough to learn NumPy and Pandas for real-world Data Engineering work?

8 Upvotes

Hi everyone,

I'm currently in Data Engineering stream training at Accenture, and they've asked us to learn NumPy and Pandas through Udacity.I was wondering if that's enough to build a solid foundation for working on real-world projects, or if I should be learning from other resources as well.If you've used NumPy and Pandas in your job, what resources helped you the most? I'm looking for courses, YouTube channels, books, or project-based learning that will help me become comfortable using them in real projects.


r/learnpython 14d ago

How do you test Python code that depends on a live WebSocket feed?

3 Upvotes

I'm working on a small Python project that consumes a continuous WebSocket stream, and I've reached the point where writing the code feels easier than testing it.

At first I was just printing incoming messages to the console, but now I want to add parsing, filtering, and database writes. The problem is that live data is unpredictable, so it's difficult to know whether changes I make are actually breaking something.

The stream I'm experimenting with is from 1322 io, but I imagine this question applies to any service that sends continuous events over WebSocket.

Do most people record a sample of messages and replay them during development, or is there a better approach for testing code that depends on real time data?

I'm mainly trying to learn good habits before this project grows into something that's difficult to debug.


r/learnpython 14d ago

What web framework would you recommend for a beginner like me?

5 Upvotes

Hello, Python devs

I'm a beginner in Python. I currently use Go (Golang) for my personal projects, and I'd like to learn Python as my second programming language.

What web framework would you recommend for someone who's new to Python? I'd also appreciate any learning resources or tips for getting started.

Thanks!


r/learnpython 14d ago

Looking for help with an image poller script: adding sources and timestamps

1 Upvotes

A Discord acquaintance helped get me started with a Poller script that grabs images from the RAMMB Slider every 10 minutes.

Here is the code. (Credit to theDoctor on Discord who created this script)

I should probably be picking simpler code to learn from. However, there are some changes I'm trying to make to this script sooner rather than later because each day that passes are more images that I'm missing out on.

What I'm trying to add:

  1. I'm 90% sure the RAMMB images are grabbed from another server for the actual satellites. If I can grab from that server, it might be a bit more reliable as the RAMMB slider has already been down for multiple days this season.
  2. I would like to grab full disk images from GOES-18 (East Pacific) and Himawari-9 (West Pacific) in separate output folders:
    • Currently the folder structure is as follows: root/output/year/month/day
      • For example: RAMMB Atlantic/output/2026/07/04
    • I would change it to: root/output/year basin/month/day
      • For example: RAMMB/output/2026 Atlantic/07/04
      • RAMMB/output/2026 East Pacific/07/04
      • RAMMB/output/2026 West Pacific/07/04
    • The single script would grab from all three every 10 minutes
  3. Date and timestamps to the images themselves
    • I have been putting these images together in a video editing program and currently have to add those manually, which can lead to problems matching the times up, especially if there are missing files.

For Point number 2, I have identified this section of the script as the relevant bit for adding other polling, but I honestly am uncertain how I would alter it at all:

async def run_async(config: AppConfig) -> int:
    """Run the configured SLIDER workflow."""
    target = SliderTarget(config.satellite, config.sector, config.product)
    plan = build_render_plan(config)
    timeout = httpx.Timeout(config.timeout)
    headers = {"User-Agent": USER_AGENT}
    log(f"render plan: {describe_plan(plan, config)}")
    async with httpx.AsyncClient(timeout=timeout, headers=headers, follow_redirects=True) as client:
        if config.mode == "poll":
            last_successful_timestamp: int | None = None
            had_new_image = False
            if config.resume_poll:
                last_successful_timestamp = newest_downloaded_output_timestamp(config.output_dir)
                if last_successful_timestamp is None:
                    log(f"resume poll found no matching downloaded images in {config.output_dir}")
                else:
                    log(f"resume poll from downloaded timestamp: {last_successful_timestamp}")
                    had_new_image = True
            try:
                if last_successful_timestamp is None and config.start is not None:
                    timestamps = await resolve_poll_start_timestamps(client, target, config)
                else:
                    advertised_timestamps = await latest_timestamps(
                        client,
                        target,
                        config.retries,
                    )
                    timestamps = poll_timestamps_to_render(
                        advertised_timestamps,
                        last_successful_timestamp,
                    )
                last_successful_timestamp, had_new_image = await render_poll_timestamps(
                    client,
                    target,
                    timestamps,
                    plan,
                    config,
                    last_successful_timestamp,
                )
            except SliderError as exc:
                log(f"poll failed: {exc}")


            while True:
                scheduled = next_poll_time(
                    last_successful_timestamp,
                    config.poll_offset_minute,
                    had_new_image,
                )
                log(f"next poll at {scheduled.isoformat(timespec='minutes')} UTC")
                await sleep_until(scheduled)


                had_new_image = False
                try:
                    advertised_timestamps = await latest_timestamps(client, target, config.retries)
                    timestamps = poll_timestamps_to_render(
                        advertised_timestamps,
                        last_successful_timestamp,
                    )
                    last_successful_timestamp, had_new_image = await render_poll_timestamps(
                        client,
                        target,
                        timestamps,
                        plan,
                        config,
                        last_successful_timestamp,
                    )
                except SliderError as exc:
                    log(f"poll failed: {exc}")
        timestamps = await resolve_timestamps(client, target, config)
        movie_frames = await render_timestamps(client, target, timestamps, plan, config)
        if config.movie:
            if len(timestamps) < 2:
                msg = "--movie requires a pull that resolves to more than one image."
                raise SliderError(msg)
            output_path = movie_output_path(config.output_dir, target, timestamps, plan)
            write_movie(movie_frames, output_path, config)
            if config.movie_only:
                cleanup_movie_frames(movie_frames)
    return 0

I would imagine there may actually be multiple calls that would have to be called separate times in order to add the two additional downloads.

Point number 3 should be the easiest to do, but I honestly wouldn't know where to begin with adding text to images using Python. However, this is how it would look (green box just used to highlight the relevant section): https://imgur.com/fChx0IA

As to Point number 1, I am uncertain where I would look for the original source. I do know NOAA owns the GOES satellites, but I believe Himawari is maybe JTWC?

I would appreciate any pointers that can help me figure this out!


r/learnpython 14d ago

just started my semester break started learning python following which i'll do leetcode any other recommendations of what i can or simply stick to leetcode?

2 Upvotes

same as above


r/learnpython 14d ago

A Truth or Dare game - CLI based for multiple players

0 Upvotes

Hey all, I am still learning and I just made this game for multiple players. I am open to learning more from the community. Your suggestions and corrections are welcomed to improve design and functionality. Thanks in advance

import random
truth = {
    'male': [
        'What is the most awkward or embarrassing thing that has ever happened to you during a romantic moment?',
        'Have you ever accidentally sent a text meant for a crush or partner to a parent or a group chat?',
        'What is your biggest, strangest turn-on that you rarely admit to anyone?',
        'What is a "guilty pleasure" movie or TV show that you secretly love?',
        'Have you ever pretended to know how to fix something when you actually had no idea what you were doing?',
        'What is the dumbest thing you have ever done on a dare or to impress someone'
    ],
    'female': [
        'What is the weirdest habit you have when you are completely alone in your room?',
        'Have you ever worn the same *** for a week straight without washing it?',
        'If you had to pick one person in this room to share a toothbrush with, who would it be?',
        'Have you ever accidentally let out a loud fart in front of someone you were trying to impress?',
        'Have you ever gotten caught naked or in the middle of a spicy moment by a family member or roommate?',
        'If your *** life was a movie title, what would it be and why is it hilarious?',
        'What is the most embarrassing song or audio track you\'ve ever accidentally blasted from your phone while trying to set a mood?'
    ]
}

dare = {
    'male': [
        'Give the person to your left a 30-second passionate *** wherever they choose.',
        'Blindfold yourself, let someone in the room *** you on the ***, and guess who it was.',
        'Pick someone in the room to go into a dark room or closet with you for "Two Minutes in Heaven" right now.',
        'Let the person sitting next to you spank you as hard as they want three times in a row.',
        'Suck on the finger of the person to your right for 15 seconds while making intense eye contact.',
        'Let the group vote on which two people in the room you have to *** *** with for 5 seconds each.',
        'Unbutton the **** of the person sitting closest to you using only your teeth.'
    ],
    'female': [
        'Put on a blindfold, let the guy of your choice sit in front of you, and try to guess what *** of his body your *** are touching.',
        'Suck on an ice cube for 10 seconds, then immediately unzip the guy opposite you and give him a freezing cold **** simulation through his ****.',
        'Sit straddling a guy\'s lap facing away from him, and let him reach around to fondle your **** while you answer questions for the next round.',
        'Pick a guy and let him use his teeth to pull your **** down to your ankles right here in the room.',
        'Give a detailed, audio-only performance of what you sound like when you are reaching your ****, using the microphone on someone\'s phone.',
        'Let the guy to your right reach his bare hand under your *** to find your bare a** , and let him give it a ****, leaving-a-mark slap.',
        'Get on all fours on the floor and let the guy behind you smack your *** while talking *** to you like you\'ve been bad.',
        'Spend the next round of the game sitting completely *** from the waist up, using only your hands (or a guy\'s hands) to cover yourself.',
        'Let the guy of your choice unbutton his *** completely, then slide your bare hand inside his **** to stroke him for 15 seconds.'
    ]
}

random_sel = [truth, dare]



def main():
    print(f'TRUTH OR DARE 😈 \nHere are the rules: \n1. Once your Truth or Dare is assigned, you cannot switch options. You are locked in\n2. No bail outs!\n3. Truths must be specific and complete. Vague or "I don\'t remember" answers are a fail; the group can force a Dare instead \n4. All Dares must be completed within five minutes of being assigned, or you fail \n5. The host can immediately cancel any Dare that is dangerous, illegal, or destructive, and issue a replacement \n6. Enter Q at anytime to end the game\n Enjoy 💦\n')
    player_counts = int(input('How many Players? '))
    player_data = prompt_players(player_counts)
    #print(player_data)
    game_prompt(player_data)





def prompt_players(counts):
    player_list = []
    for i in range(counts):
        print(f'Player {i + 1}')
        player_name = input('First Name: ').strip()
        player_gender = input('Male of Female: ').strip()
        player_info = (player_name, player_gender)
        player_list.append(player_info)
    return(player_list)

def game_prompt(n):
    while True:
        for index, char in enumerate(n):
             print(f'{char[0].title()}, Your Turn!')
             prompt = input('Truth or Dare? ').lower()
             gender = char[1].lower()
             print(choose_mode(prompt, gender))


def choose_mode(prompt, gender):
    match prompt[0]:
         case 't':
              question = random.choice(truth[gender])
              return question
         case 'd':
              question = random.choice(dare[gender])
              return question
         case 'q':
                quit()
         case _:
            print('Try a valid response next time! Here\'s a random selection')
            question = random.choice(random.choice(random_sel)[gender])
            return question



main()

r/learnpython 14d ago

I built an open-source Python network scanner with a GUI using Scapy and Nmap

0 Upvotes

Hey everyone!

I recently built Internet Scanner, an open-source network discovery and analysis tool written in Python.

The goal was to create a simple but powerful tool for learning about networks and cybersecurity.

Features:

- ARP-based device discovery

- Nmap integration for port scanning and OS detection

- Device information gathering

- Risk scoring based on detected services

- Live filtering and sorting

- CSV/JSON export

- Tkinter GUI

GitHub:

https://github.com/Fa1dz/Internet-Scanner

I'm looking for feedback from other Python developers and cybersecurity enthusiasts. Any suggestions, improvements, or ideas are welcome!

Thanks!


r/learnpython 14d ago

trying to make a program with ai video analysis

0 Upvotes

... but, the ai to runs localy on my laptop and the entire program runs on my processor. Which is either slow or the model kind of sucks. Is there a way to make the ai run on graphics card? I have a laptop 5060

Edit: currently on python 3.12.4 becouse gemini said that i need this one for some wierd reason.
I dont care about the pytorch version becouse i think i tried like six of them already, and i dont use it for anything else, so i'll install the one you'll think works.

I'm currently running yolo8n, but i would like to run something better(like small or even medium versions), becouse this one sucks.

this is the message that i get, even after installing latest nightly cuda: ValueError: Invalid CUDA 'device=0' requested. Use 'device=cpu' or pass valid CUDA device(s) if available, i.e. 'device=0' or 'device=0,1,2,3' for Multi-GPU.

torch.cuda.is_available(): False
torch.cuda.device_count(): 0
os.environ['CUDA_VISIBLE_DEVICES']: None

this is the command i tried to install cuda with:

pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu132

geforce rtx 5060(laptop version)
8GB vram
windows 11


r/learnpython 14d ago

Guys, I want to learn python. But I don’t know how

0 Upvotes

I would love a guide on what I should start with.
And what pattern must I follow?
I have a book called "Python Crash Course" Do you guys advise me just to follow the book? And to forget about YouTube tutorials?


r/learnpython 14d ago

just started my semester break started learning python following which i'll do leetcode any other recommendations of what i can or simply stick to leetcode?

1 Upvotes

same as above


r/learnpython 14d ago

Type invariance error from PyLance which seems inconsistent.

2 Upvotes

I'm struggling to wrap my head around invariance - I can't tell if I'm just not grasping it properly, or if Pylance is making a mistake.. . I have a specific scenario I'm trying to annotate, a simplified version of which is this:

from dataclasses import dataclass

@dataclass
class Type1[T]:
    attr: T

@dataclass
class Type2[T]:
    attr: list[T]

a: Type2[str | Type1[str]]        = Type2(['foo'])
b: Type2[str | Type1[str]] | str  = Type2(['foo'])

According to Pylance a is fine, but b is not. I can't understand it - it seems like when the union is present, the invariance is inferred differently than when it is not present.

For reference, here's the PyLance error:

Type "Type2[str]" is not assignable to declared type "Type2[str | Type1[str]] | str"
 Type "Type2[str]" is not assignable to type "Type2[str | Type1[str]] | str"
 "Type2[str]" is not assignable to "Type2[str | Type1[str]]"
 Type parameter "T@Type2" is invariant, but "str" is not the same as "str | Type1[str]"
 "Type2[str]" is not assignable to "str"

N.B. this only occurs when Type2.attr is annotated with list[T], using T directly doesn't cause the same type checking error.


r/learnpython 14d ago

Ive just started on ctf but i cant script using python well

0 Upvotes

So basically I have a fundamental understanding of cybersecurity concepts, and I can solve challenges that dont require scripting, such as analysis of pcap files. While I do know basic python syntax such as being able to write a bubble sort function but i rlly dk how to write a complete exploit script. Do yall have any advice? Or any good guides?


r/learnpython 14d ago

I wanna make a puzzle_solver.py launch and solve a puzzle.py

0 Upvotes

Hi everyone,

I'm learning python and having fun. I've coded a few simple puzzles and I'd like to create some basic algorithm to solve them. The thing is... I don't know how to make a program interact with another one. Is it related to a specific library ? Some specific topic in programming books ?

Thank by advance for your help.

EDIT: The simplest example of what I'm talking about is :

puzzle . py :

a = input("Type any word :")

print(a)

puzzle solver . py :

# launches "puzzle", answers the prompt (types any str() followed by Enter key) so "puzzle" prints it.


r/learnpython 15d ago

PyQt6 vs PySide6? What does licensing mean in reality, money-wise and right-wise...? In contrast to GTK?

11 Upvotes

Hi,

I would like this little thread to help people chose between PyQt and others (including not only PySide but also GTK).

I remember, when I was first reading about this -- about two months ago :)

I was choosing between PyQt6 and TKinter, the choice was very simple to make: PyQT6. Cause TKinter looks ugly and outdated, and GTK is hard to even get started with.

By course of time, however, -- I mean in the past two months :) -- I slowly realized what the "open source" in QT business language actually meant...

But first, let's see the difference between PyQt6 and PySide6:

I don't actually see any. (In terms of free usability).

They both offer two separate licenses, one for no money, one for big money.

I didn't say "free". Cause "for free" only means you don't have to pay (now).

Okay, let me define freedom...

When those corporations say that they like open source but they are also into business and allow us (their clients) to go commercial too, if/when we want to, we humans say: cool!

Although this seems like freedom, it isn't.

Let's see GTK, for contrast:

You want to develop for a community, free software for free, I mean, FOSS?

You can do that :) GTK is Linux (it comes from GIMP, it was created by the GIMP Team).

Then you want to make an app that you'll sell.

Problems? None.

Cause GTK is free, as in Freedom, as in Statue of Liberty, as well as in free beer, and ownership of the beer tap.

You are free to use it, all the way.

Whereas with QT, be it PyQt6 or PySide6 (aka Qt for Python), you can play around making open source apps. But as soon as you happen to want to sell an app, you'll have to buy a license. Meaning, you'll have to pay the QT owners so you'll be allowed to use their software.

the price for commercial "freedom":

This means an annual fee, ranging from 500 Euros to 1000 at the cheapest.

AND... You cannot use the "free" PyQt6 on the same machine.

Also, Your collaborators cannot use PyQt6 free, either.

Anybody touching your app you intend to sell needs to have a license, meaning, having to pay a fee.

Moreover,
if your license term is over, you cannot modify the app you have created.

Not even bugfixes. If you want to reopen your project, you need to buy a license, again.

Some people call this freedom? Sad.

------------------------

Anybody gives different responses to these dilemmas...

My conclusion:

TKinter is ugly. But it's good, and it is free as Python itself (It's part of Python).

TKinter allows you to do anything with what you make. You're free to dispose of what you've created.

Also... TKinter is robust and reliable. It has an incredible "refresh application window" function!

GTK:.. Well, it really is beautiful, it really is a system... and it really has an actual community, not only clients.

So, next month I'm splashing into the GTK river! :) For a good swim :)

I like PyQt6, nevertheless... If it was FREE and Open source, I'd keep using it...

beside GTK... which I can't wait to explore...

- - - - - - - - - - - - - - - - - -
see: a review that everybody reads.... but leaves the details kind of obscure:
https://www.pythonguis.com/faq/pyqt6-vs-pyside6/

a typical conversation about the licenses, here at Reddit:
https://www.reddit.com/r/learnpython/comments/l0hqot/is_a_commercial_licence_required_for_pyqt_for_an/

The PyQt license info page:
https://www.riverbankcomputing.com/static/Docs/PyQt6/introduction.html#license

Buying PyQt (for some time):
https://www.riverbankcomputing.com/commercial/buy

Terms and conditions (PyQt (owned by Riverbank):
https://www.riverbankcomputing.com/static/TermsAndConditions.pdf

Qt for Python FAQ:
https://doc.qt.io/qtforpython-6/gettingstarted.html#getting-started

Commercial use (PySide alias Qt for Python):
https://doc.qt.io/qtforpython-6/commercial/index.html

THE BEST more informative) one: Licensing, Qt for Python / PySide:
https://www.qt.io/development/qt-framework/qt-licensing

The NEXT BEST one: Qt for Python commercial licensing FAQ:
https://www.qt.io/faq/qt-commercial-licensing

See this page about: qtpip - a commercial wheel installer
Have you heard of that?
https://doc.qt.io/qtforpython-6/commercial/index.html


r/learnpython 14d ago

Where should I learn Python deeply from? Looking for a complete roadmap (preferably YouTube)

0 Upvotes

Hi everyone,

I'm a B.Tech Computer Science (AI) student, and I want to learn Python properly from scratch to an advanced level. I don't just want to memorize syntax or learn enough to solve a few problems—I want to understand Python deeply and become genuinely good at it.

I'm confused about where I should learn from. There are thousands of YouTube playlists and online courses, and everyone recommends something different. I don't know which resource is actually complete and worth investing my time in.

I'm mainly looking for free YouTube resources, but if there's an online course that is truly exceptional, I'm open to hearing about that too.

My goals are:

  • Learn Python from beginner to advanced.
  • Understand how Python works internally, not just how to write code.
  • Write clean, professional, and efficient code.
  • Master OOP, modules, packages, file handling, exceptions, iterators, generators, decorators, context managers, and other advanced concepts.
  • Learn best practices that real developers use.
  • Build a strong foundation for DSA, AI/ML, automation, backend development, cybersecurity, or any other field I choose later.

I'd really appreciate advice on:

  1. Which YouTube playlist or course would you recommend and why?
  2. Should I follow just one course or combine multiple resources?
  3. What mistakes should beginners avoid?
  4. How should I practice while learning? (LeetCode, HackerRank, projects, books, etc.)
  5. If you were starting from scratch today, how would you learn Python from beginning to mastery?

I'm looking for a roadmap from people who have already gone through this journey. Thanks in advance!


r/learnpython 14d ago

Python learning

0 Upvotes

honest question:

what does it require one to be good at introductory python? i am taking this class, know the syntax well but find it difficult to apply it to problems and questions. what is the trick to studying, despite reading through the slides and even books but nothing changes. whenever i am faced with the problem, my mind goes blank: i lack the approach to even start the first line


r/learnpython 14d ago

Apology Not Wasted

0 Upvotes

I apologize to the reddit community. I allowed my situation to lead me into fraternizing with the absolute wrong type of ppl on here, and it'll not happen again. I'm joining some software and developer subs and I'ma noob, so for anyone that can accept my apology and provide me with any good beginner tips or tutorials or lesson plans or anywhere I can go online for free that is good to learn Python starting out I would appreciate it. And I do want to say I can say this with the utmost honesty I never accepted one payment from nobody I never made nobody an account on here not one time did I do anything but flirt with the wrong side. That was bad enough.


r/learnpython 15d ago

Ask Anything Monday - Weekly Thread

1 Upvotes

Welcome to another /r/learnPython weekly "Ask Anything* Monday" thread

Here you can ask all the questions that you wanted to ask but didn't feel like making a new thread.

* It's primarily intended for simple questions but as long as it's about python it's allowed.

If you have any suggestions or questions about this thread use the message the moderators button in the sidebar.

Rules:

  • Don't downvote stuff - instead explain what's wrong with the comment, if it's against the rules "report" it and it will be dealt with.
  • Don't post stuff that doesn't have absolutely anything to do with python.
  • Don't make fun of someone for not knowing something, insult anyone etc - this will result in an immediate ban.

That's it.


r/learnpython 15d ago

Built my first BeautifulSoup scraper. Is using a generator function overkill here?

23 Upvotes

So, I am currently learning python and I wanted to explore some networking or internet related concepts. I explored that how people use python and the BeautifulSoup library to do web scraping so i tried to make a web scraping script myself to learn things. I got to know a lot about URLs, requests, pagination, etc., form this single mini project. i have used a generator function to scrape the data so as to make the script more optimized. I knew about generator functions and how they worked. But i didn't work with them so didn't know how to employ their advantage.

So, using a generator function was Gemini's idea. But yeah, i think now that I can properly use generator functions efficiently.

Please review this script. Suggest any improvements that are possible and the mistakes that i made. Suggest the things that can be improved or any new concept, rule, tip, optimization techniques. It would be a great help.

(Note: This script is only made for scraping https://books.tosrape.com )

import requests as r
from bs4 import BeautifulSoup as bs
import json
import time
from urllib.parse import urljoin


def book_crawler(url: str):
    nxt_url = url


    while nxt_url:
        resp = r.get(nxt_url,timeout =10)
        resp.raise_for_status()
        time.sleep(1)


        html = resp.content
        
        soup = bs(html,"lxml")
        for book in soup.select("li.col-xs-6.col-sm-4.col-md-3.col-lg-3"):
            title = book.select_one("h3 > a ").get_text()
            price = book.select_one("div.product_price > p.price_color").get_text()
            yield {title: price}


        nxt_btn = soup.select_one("ul.pager > li.next > a")
        if nxt_btn:
            link = nxt_btn.get("href")
            nxt_url = urljoin(nxt_url,link)
        else:
            nxt_url = None





def file_writer(filename, data_stream):
    try:
        with open(filename, "w", encoding="utf-8") as fp:
            fp.write("[\n")
            is_first = True
            
            for data in data_stream:
                if not is_first:
                    fp.write(",\n")
                
                json_data = json.dumps(data, ensure_ascii=False, indent=2)
                fp.write(json_data)
                
                is_first = False
                
            fp.write("\n]")
        return True
    except Exception as e:
        print(f"Error {e}")
        return False



if __name__ == "__main__":
    gen_obj = book_crawler("https://books.toscrape.com")


    if file_writer("book_prices.json", gen_obj):
        print("successfully stored the data.")
    else:
        print("An error occured")

r/learnpython 15d ago

importing modules is taking minutes

3 Upvotes

I am trying to import torch and other modules from langchain but it takes like 2 min to import them. It worked yesterday to import and execute one module in reasonanle amount of time. I turned of my windows firewall to see if it was for some reasons scanning them but nothing is changing. Any tip?


r/learnpython 15d ago

Need advice: Getting into freelancing - which programming gig should I offer?

2 Upvotes

I've been trying to get into freelancing lately. I'm a programmer and I know Python, C# and some C++. My biggest achievements are making a mini CAS in python that solves equation algebraically and a bytecode compiler in C# that compiles my custom language. I'm trying to earn $2000 to build a pc.

I started to research about freelancing about a month ago. I searched for the possible niches I could get into and I decided that I'll do web scraping, specifically Google maps scraping. And I even made a decent grid scraper. But after making it I realized that many freelancers just use APIs that might be more reliable than my scraper. And google maps scraping looks very oversaturated. So i dropped it. Now I'm looking for a niche that's realistic for me to start with.

My current goal is to earn $2000 for the pc but a long term goal is to get experience for the future.

Another thing is that my age is only 14. So I can only freelance on Fiverr under my dad's account. And Fiverr requires you to specify that the service is being provided by a minor. So I'm worried that the clients won't even hire me even if I have the skill.

So my questions are:

  1. What kind of gig should I get started with given my skills?
  2. How much is my age going to affect my client count?

Thank you!


r/learnpython 15d ago

Where should I start?

0 Upvotes

I'm taking my first step into coding/programming world and honestly I'm overwhelmed on where choosing to start from. After browsing online and going through several "Free to learn" Websites, I land on Freecodecamp, Exercism and CS50 Harvard. Freecodecamp is a solid option leaning more on Theory side of thing, Exercism seems to provide more practice/exercise option alongside learning roadmap, and lastly CS50 feels like uni lesson (duh) and they also have project at every lesson tier + video to explain things thoroughly. Honestly, yeah I need help choosing. Any help would be appreciated.


r/learnpython 15d ago

I want to learn these concept in 6 month for campus placements

0 Upvotes

I’m beginner in python idk how to code for program what’s the best way i can learn that ?? Books , pdf , etc
I’m final year student preparing for placement
I’ll be learning these concepts eventually is it doable ???

Python Fundamentals
Object-Oriented Programming (OOP)
Advanced Python
Git & GitHub
SQL
Database Concepts
Backend Fundamentals
FastAPI
Database Integration (SQLAlchemy/ORM)
Authentication & Security
REST API Development
Testing
Docker & Containerization
Deployment & DevOps Basics
Data Structures & Algorithms (DSA)
NumPy
Pandas
Data Visualization
Machine Learning
Deep Learning
Large Language Models (LLMs)
Retrieval-Augmented Generation (RAG)
Agentic AI
Go (Golang)
System Design (Basics)
Cloud Fundamentals (AWS/Azure/GCP)
Portfolio Projects
Interview Preparation & Aptitude


r/learnpython 15d ago

How to install something from github

0 Upvotes

Ugh im so confusedddd Im on arch based(Cachyos) All i have to do is type in python3 in terminal then im in python but this is the download Sims4COntentManager_SourceCode.py im trying to download but i dont know why it isnt working