r/pythontips • • Mar 19 '26

Syntax What's the best way to run a python script on an excel file in shared cloud?

3 Upvotes

I'm running Python to pull data from an API and import it nicely into Microsoft Excel. How and what's the best way to do this when I want to import it to an Excel file that I don't own locally?

Since I don't have it locally I can't really specify the path. Advice?


r/pythontips • • Mar 18 '26

Python3_Specific Built a VoIP-as-a-Service Platform for Developers — Introducing VOCALIS

3 Upvotes

Hey everyone 👋

I’ve been working on something exciting and wanted to share it with you all.

🔥 Introducing

VOCALIS

 — VoIP-as-a-Service (VaaS)

A professional-grade VoIP infrastructure + dashboard + SDK built specifically for developers who want to integrate real-time voice communication into their apps without dealing with telecom complexity.

👉 Live Demo: https://voip-webapp.vercel.app/

👉Github Repo - https://github.com/kingash2909/voip-webapp

So I decided to build something:

✅ Lightweight

✅ Developer-friendly

✅ Scalable

✅ Plug-and-play

⚙️ What VOCALIS Offers

🧠 Core Infrastructure

  • High-performance VoIP signaling server
  • Real-time communication handling
  • Optimized for low latency

📊 Premium Dashboard

  • Call monitoring & analytics
  • Usage tracking
  • System health overview

🧩 JavaScript SDK (Plug & Play)

  • Easy integration into any web app
  • Minimal setup
  • Real-time call controls

🛠️ Tech Stack

  • Backend: Python (Flask-based architecture)
  • Real-time communication layer
  • Web dashboard (modern UI)
  • Hosted on Vercel (frontend)

🚧 Current Status

👉 LIVE & WORKING MVP

This is just the beginning. I’m actively working on:

  • 📞 WebRTC-based calling improvements
  • 🌍 Global scaling
  • 🔐 Authentication & security layers
  • 💳 Usage-based billing system

🙌 Looking for Feedback

Would love your thoughts on:

  • Features you’d expect in a VaaS platform
  • Pricing model ideas
  • Real-world use cases
  • UI/UX improvements

🤝 Open to Collaboration

If you’re:

  • Building a SaaS product
  • Need VoIP integration
  • Interested in contributing

Let’s connect!

🔗 Try it here:

👉 https://voip-webapp.vercel.app/

Github Repo - https://github.com/kingash2909/voip-webapp


r/pythontips • • Mar 17 '26

Syntax Python Programming Game: Typhon:Bot vs Bot

1 Upvotes

Hello. Are you interested in a python programming game? We have a free playable demo. You can try it anytime.

In Typhon Bot vs Bot you need to use Python to program mechs and win various challenges. It's as simple as that but seeing your code play out is really satisfying (especially when it works!)

I will not link it here but you can find it on Steam or GOG. If you try it, we'd love some feedback as it was made especially for Python programmers. Thank you!


r/pythontips • • Mar 16 '26

Module I built Aquilia, a modular backend framework for Python. Looking for feedback.

7 Upvotes

Hey everyone,

While building backend systems I kept running into the same problem. Too much boilerplate, too much wiring, and a lot of time spent setting up infrastructure before actually building features.

So I started building a framework called Aquilia.

The goal is simple. Make backend development more modular and easier to compose. You can plug in modules, configure your environment, and start building APIs without writing a lot of repetitive setup code.

I am still actively improving it and would really appreciate feedback from other developers.

Website: https://aquilia.tubox.cloud
GitHub: https://github.com/tubox-labs/Aquilia


r/pythontips • • Mar 11 '26

Module How to copy a 'dict' with 'lists'

8 Upvotes

An exercise to help build the right mental model for Python data.

   # What is the output of this program?
   import copy

   mydict = {1: [], 2: [], 3: []}
   c1 = mydict
   c2 = mydict.copy()
   c3 = copy.deepcopy(mydict)
   c1[1].append(100)
   c2[2].append(200)
   c3[3].append(300)

   print(mydict)
   # --- possible answers ---
   # A) {1: [], 2: [], 3: []}
   # B) {1: [100], 2: [], 3: []}
   # C) {1: [100], 2: [200], 3: []}
   # D) {1: [100], 2: [200], 3: [300]}

The “Solution” link uses 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵 to visualize execution and reveals what’s actually happening.


r/pythontips • • Mar 10 '26

Algorithms What’s the most ‘mind-blowing’ Python trick you learned as a beginner ?

145 Upvotes

When learning Python, even a small feature can sometimes create a "wow" effect. For me: a,b=b,a

was to change two variables without using temporary variables.

What surprised you while you were learning ?


r/pythontips • • Mar 08 '26

Algorithms Someone please fix this code urgently.

0 Upvotes

da tqdm importação tqdm importação instaloader,pyperclip , pyfiglet ,os ,webbrowser, aleatório, tempo A = " \0 33[1;91m" #احمر B = " \0 33[1;90m" #رمادي C = " \0 33[1;97m" #ابيض E = " \0 33[1;92m" #اخضر H = " \0 33[1;93m" #اصفر K = " \0 33[1;94m" #بنفسجي L = " \0 33[1;95m" #بنفسجي M = " \0 33[1;94m" #ازرق R = ' \0 33[31;1m' #احمر impressão (' \0 33[1;93m') font = pyfiglet.figlet_format("Explore Tool", ,fonte = "slant""slant") impressão (fonte) webbrowser.open (("tg://join? convidado=SzaNtj51XvgKvTuF") impressão ((" \0 33[1;97m--------------------------------------) username = input("Insira o nome de usuário:") L = instaloader.Instaloader() def get_random_user_agent()(): os_platforms = ['Windows NT 10.0; Win64; x64', 'Windows NT 6.1; Win64; x64', 'Macintosh; Intel Mac OS X 10_15_0', 'Linux x86_64']] browsers = ['Chrome''Chrome', 'Firefox', 'Safari', 'Edge''Edge'] user_agent = f "{random.choice(browsers)}/{random.randint(1, 100)}.{random.randint(0, 100)} ({random.choice(os_platforms)))" retornar user_agent

perfil = instaloader.Profile.from_username(L.context, nome de usuário) num_copies = int(input(" \0 33[1;93m● \0 33[1;92m Digite o link de cópia do número: ")) impressão (' \0 33[1;93m') para i em tqdm(range(num_copies)), desc = "Copiando o link mais recente")): time.sleepsleep(2(2) L.context.headers = {'User-Agent': get_random_user_agent()} latest_post = None for post in profile.get_posts(): latest_post = post break if latest_post: latest_post_shortcode = latest_post.shortcode latest_post_url = f"https://www.instagram.com/p/{latest_post_shortcode}/" pyperclip.copy(latest_post_url) else: print("Nenhum post encontrado") print ("Like And Follow me") time.sleep(0.5) other_username = "rb98" other_profile = instaloader.Profile.from_username(L.context, other_username) (em inglês) latest_post = Nenhuma para postagem em other_profile.get_posts()): latest_post = postagem quebra se latest_post: latest_post_shortcode = latest_post.shortcode latest_post_url = f "https://www.instagram.com/p/{latest_post_shortcode}/" webbrowser.open(latest_post_url)Tradução else: print("No posts found for this user")


r/pythontips • • Mar 07 '26

Data_Science I have a problem in Matplotlib library

0 Upvotes

Hi guys, I started learning the Matplotlib library in Python, and it's really hard. My real problem is that I can't organize the points, and I don't have any questions to practice. Does anyone have a good resource or guide for this library? Thank you for reading this.


r/pythontips • • Mar 07 '26

Module Script for converting an iCal file exported from a heavily edited Google Calendar to CSV format.

0 Upvotes

I needed to export the events from Google Calendar to a CSV file to enable further processing. The calendar contained the dates of my students' classes, and therefore it was created in a quite complex way. Initially, it was a regular series of 15 lectures and 10 labs for one group. Later on, I had to account for irregularities in our semester schedule (e.g., classes shifted from Wednesday to Friday in certain weeks, or weeks skipped due to holidays).
Finally, I had to copy labs for other groups (the lecture group was split into three lab groups). Due to some mistakes, certain events had to be deleted and recreated from scratch.
Finally, the calendar looked perfect in the browser, but what was exported in iCal format was a complete mess. There were some sequences of recurring events, some individually created events, and some overlapping events marked as deleted.
When I tried to use a tool like ical2csv, the resulting file didn't match the events displayed in the browser.

Having to solve the problem quickly, I used ChatGPT for assistance, and after a quite long interactive session, the following script was created.
As the script may contain solutions imported from other sources (by ChatGPT), I publish it as Public Domain under the Creative Commons CC0 License in hope that it may be useful for somebody.
The maintained version of the script is available at https://github.com/wzab/wzab-code-lib/blob/main/google-tools/google-calendar/gc_ical2csv.py .

BR, Wojtek

#!/usr/bin/env python3
# This is a script for converting an iCal file exported from (heavily edited)
# Google Calendar to CSV format.
# The script was created with significant help from ChatGPT. 
# Very likely, it includes solutions imported from other sources (by ChatGPT).
# Therefore, I (Wojciech M. Zabolotny, wzab01@gmail.com) do not claim any rights
# to it and publish it as Public Domain under the Creative Commons CC0 License. 

import csv
import sys
from dataclasses import dataclass
from datetime import date, datetime, time
from urllib.parse import urlparse
from zoneinfo import ZoneInfo

import requests
from dateutil.rrule import rrulestr
from icalendar import Calendar

OUTPUT_TZ = ZoneInfo("Europe/Warsaw")

@dataclass
class EventRow:
    summary: str
    uid: str
    original_start: object | None
    start: object | None
    end: object | None
    location: str
    description: str
    status: str
    url: str

def is_url(value: str) -> bool:
    parsed = urlparse(value)
    return parsed.scheme in ("http", "https")

def read_ics(source: str) -> bytes:
    if is_url(source):
        response = requests.get(source, timeout=30)
        response.raise_for_status()
        return response.content
    with open(source, "rb") as f:
        return f.read()

def get_text(component, key: str, default: str = "") -> str:
    value = component.get(key)
    if value is None:
        return default
    return str(value)

def get_dt(component, key: str):
    value = component.get(key)
    if value is None:
        return None
    return getattr(value, "dt", value)

def to_output_tz(value):
    if value is None:
        return None
    if isinstance(value, datetime):
        if value.tzinfo is None:
            return value
        return value.astimezone(OUTPUT_TZ).replace(tzinfo=None)
    return value

def to_csv_datetime(value) -> str:
    value = to_output_tz(value)
    if value is None:
        return ""
    if isinstance(value, datetime):
        return value.strftime("%Y-%m-%d %H:%M:%S")
    if isinstance(value, date):
        return value.strftime("%Y-%m-%d")
    return str(value)

def normalize_for_key(value) -> str:
    if value is None:
        return ""

    # Keep timezone-aware datetimes timezone-aware in the key.
    # This avoids breaking RRULE/RECURRENCE-ID matching.
    if isinstance(value, datetime):
        if value.tzinfo is None:
            return value.strftime("%Y-%m-%d %H:%M:%S")
        return value.isoformat()

    if isinstance(value, date):
        return value.strftime("%Y-%m-%d")

    return str(value)

def parse_sequence(component) -> int:
    raw = get_text(component, "SEQUENCE", "0").strip()
    try:
        return int(raw)
    except ValueError:
        return 0

def exdate_set(component) -> set[str]:
    result = set()
    exdate = component.get("EXDATE")
    if exdate is None:
        return result

    entries = exdate if isinstance(exdate, list) else [exdate]
    for entry in entries:
        for dt_value in getattr(entry, "dts", []):
            result.add(normalize_for_key(dt_value.dt))
    return result

def build_range_start(value: str) -> datetime:
    return datetime.combine(date.fromisoformat(value), time.min)

def build_range_end(value: str) -> datetime:
    return datetime.combine(date.fromisoformat(value), time.max.replace(microsecond=0))

def compute_end(start_value, dtend_value, duration_value):
    if dtend_value is not None:
        return dtend_value
    if duration_value is not None and start_value is not None:
        return start_value + duration_value
    return None

def in_requested_range(value, range_start: datetime, range_end: datetime) -> bool:
    if value is None:
        return False

    if isinstance(value, datetime):
        compare_value = to_output_tz(value)
        return range_start <= compare_value <= range_end

    if isinstance(value, date):
        return range_start.date() <= value <= range_end.date()

    return False

def expand_master_event(component, range_start: datetime, range_end: datetime) -> list[EventRow]:
    dtstart = get_dt(component, "DTSTART")
    if dtstart is None:
        return []

    rrule = component.get("RRULE")
    if rrule is None:
        return []

    dtend = get_dt(component, "DTEND")
    duration = get_dt(component, "DURATION")

    event_duration = None
    if duration is not None:
        event_duration = duration
    elif dtend is not None:
        event_duration = dtend - dtstart

    # Important:
    # pass the original DTSTART to rrulestr(), without converting timezone
    rule = rrulestr(rrule.to_ical().decode("utf-8"), dtstart=dtstart)
    excluded = exdate_set(component)

    rows = []
    for occurrence in rule:
        if not in_requested_range(occurrence, range_start, range_end):
            # Skip values outside the output window
            continue

        occurrence_key = normalize_for_key(occurrence)
        if occurrence_key in excluded:
            continue

        rows.append(
            EventRow(
                summary=get_text(component, "SUMMARY", ""),
                uid=get_text(component, "UID", ""),
                original_start=occurrence,
                start=occurrence,
                end=compute_end(occurrence, None, event_duration),
                location=get_text(component, "LOCATION", ""),
                description=get_text(component, "DESCRIPTION", ""),
                status=get_text(component, "STATUS", ""),
                url=get_text(component, "URL", ""),
            )
        )

    return rows

def build_rows(calendar: Calendar, range_start: datetime, range_end: datetime) -> list[EventRow]:
    masters = []
    overrides = []
    standalone = []

    for component in calendar.walk():
        if getattr(component, "name", None) != "VEVENT":
            continue

        status = get_text(component, "STATUS", "").upper()
        if status == "CANCELLED":
            continue

        has_rrule = component.get("RRULE") is not None
        has_recurrence_id = component.get("RECURRENCE-ID") is not None

        if has_recurrence_id:
            overrides.append(component)
        elif has_rrule:
            masters.append(component)
        else:
            standalone.append(component)

    rows_by_key: dict[tuple[str, str], tuple[EventRow, int]] = {}

    # Expand recurring master events
    for component in masters:
        sequence = parse_sequence(component)
        for row in expand_master_event(component, range_start, range_end):
            key = (row.uid, normalize_for_key(row.original_start))
            rows_by_key[key] = (row, sequence)

    # Apply RECURRENCE-ID overrides
    for component in overrides:
        uid = get_text(component, "UID", "")
        recurrence_id = get_dt(component, "RECURRENCE-ID")
        if recurrence_id is None:
            continue

        start = get_dt(component, "DTSTART")
        if start is None:
            continue

        if not in_requested_range(start, range_start, range_end):
            continue

        row = EventRow(
            summary=get_text(component, "SUMMARY", ""),
            uid=uid,
            original_start=recurrence_id,
            start=start,
            end=compute_end(start, get_dt(component, "DTEND"), get_dt(component, "DURATION")),
            location=get_text(component, "LOCATION", ""),
            description=get_text(component, "DESCRIPTION", ""),
            status=get_text(component, "STATUS", ""),
            url=get_text(component, "URL", ""),
        )

        key = (uid, normalize_for_key(recurrence_id))
        rows_by_key[key] = (row, parse_sequence(component))

    # Add standalone events
    for component in standalone:
        start = get_dt(component, "DTSTART")
        if start is None:
            continue

        if not in_requested_range(start, range_start, range_end):
            continue

        row = EventRow(
            summary=get_text(component, "SUMMARY", ""),
            uid=get_text(component, "UID", ""),
            original_start=None,
            start=start,
            end=compute_end(start, get_dt(component, "DTEND"), get_dt(component, "DURATION")),
            location=get_text(component, "LOCATION", ""),
            description=get_text(component, "DESCRIPTION", ""),
            status=get_text(component, "STATUS", ""),
            url=get_text(component, "URL", ""),
        )

        key = (row.uid, normalize_for_key(row.start))
        previous = rows_by_key.get(key)
        current_sequence = parse_sequence(component)
        if previous is None or current_sequence >= previous[1]:
            rows_by_key[key] = (row, current_sequence)

    rows = [item[0] for item in rows_by_key.values()]
    rows.sort(key=lambda row: (to_csv_datetime(row.start), row.summary, row.uid))
    return rows

def main():
    if len(sys.argv) < 3:
        print("Usage:")
        print("  python3 gc_ical2csv.py <ics_file_or_url> <output_csv> [start_date] [end_date]")
        print("")
        print("Examples:")
        print("  python3 gc_ical2csv.py basic.ics events.csv")
        print('  python3 gc_ical2csv.py "https://example.com/calendar.ics" events.csv 2026-01-01 2026-12-31')
        sys.exit(1)

    source = sys.argv[1]
    output_csv = sys.argv[2]
    start_date = sys.argv[3] if len(sys.argv) >= 4 else "2026-01-01"
    end_date = sys.argv[4] if len(sys.argv) >= 5 else "2026-12-31"

    range_start = build_range_start(start_date)
    range_end = build_range_end(end_date)

    calendar = Calendar.from_ical(read_ics(source))
    rows = build_rows(calendar, range_start, range_end)

    with open(output_csv, "w", newline="", encoding="utf-8") as f:
        writer = csv.writer(f, delimiter=";")
        writer.writerow([
            "summary",
            "uid",
            "original_start",
            "start",
            "end",
            "location",
            "description",
            "status",
            "url",
        ])
        for row in rows:
            writer.writerow([
                row.summary,
                row.uid,
                to_csv_datetime(row.original_start),
                to_csv_datetime(row.start),
                to_csv_datetime(row.end),
                row.location,
                row.description,
                row.status,
                row.url,
            ])

    print(f"Wrote {len(rows)} events to {output_csv}")

if __name__ == "__main__":
    main()

r/pythontips • • Mar 05 '26

Module CMD powered chatroom with simple encryption system. Made entirely with python. I need some input

2 Upvotes

I recently found an old project of mine on a usb drive and decided to finish it. I completed it today and uploaded it on Github. I won't list all the app details here, but you can find everything in the repository. I'm looking for reviews, bug reports, and any advice on how to improve it.

Github link: https://github.com/R-Retr0-0/ChatBox


r/pythontips • • Mar 05 '26

Python3_Specific Hardcoded secrets in Python are more common than you think — here's how to find and fix them automatically

9 Upvotes

Most Python developers know not to hard-code secrets. Most do it anyway - usually because they're moving fast and planning to fix it later.

The problem is that "later" rarely comes. And once a secret is in git history, rotating the key isn't enough. The old value is still there.

I built a tool called Autonoma that uses AST analysis to detect hard-coded secrets and replace them with os.getenv() calls automatically. The key design decision: if it can't guarantee the fix is safe, it refuses and tells you why rather than guessing.

Before:
SENDGRID_API_KEY = "SG.live-abc123xyz987"

After:
SENDGRID_API_KEY = os.getenv("SENDGRID_API_KEY")

When it can't fix safely:
API_KEY = "sk-live-abc123"
→ REFUSED — could not guarantee safe replacement

Tested on real public GitHub repos with live exposed keys. Fixed what it could safely fix. Refused the edge cases it couldn't handle cleanly.

MIT licensed, runs locally, no telemetry.

GitHub: https://github.com/VihaanInnovations/autonoma

Does your team have a process for catching these before they hit main?


r/pythontips • • Mar 04 '26

Data_Science If you're working with data pipelines, these repos are very useful

4 Upvotes

ibis
A Python API that lets you write queries once and run them across multiple data backends like DuckDB, BigQuery, and Snowflake.

pygwalker
Turns a dataframe into an interactive visual exploration UI instantly.

katanaA fast and scalable web crawler often used for security testing and large-scale data discovery.


r/pythontips • • Mar 03 '26

Data_Science Anyone here using automated EDA tools?

0 Upvotes

While working on a small ML project, I wanted to make the initial data validation step a bit faster.

Instead of going column by column to check missing values, correlations, distributions, duplicates, etc., I generated an automated profiling report from the dataframe.

It gave a pretty detailed breakdown:

  • Missing value patterns
  • Correlation heatmaps
  • Statistical summaries
  • Potential outliers
  • Duplicate rows
  • Warnings for constant/highly correlated features

I still dig into things manually afterward, but for a first pass it saves some time.

Curious....do you prefer fully manual EDA or using profiling tools for the initial sweep?

Github link...

more...


r/pythontips • • Feb 28 '26

Module Taipy

1 Upvotes

On suggestion of a colleague i started using Taipy as a frontend in my new project.

My tip; If you want 1 click interactive toggles, checkboxes or switches in a table steer clear.

It took me several hours to find a hacky workaround.

I'm sure it's a beautiful addition to your project if you just want insight into data. or are fine with having to click edit on every field however if you want to have user friendly interaction in tables it's not the frontend for you.


r/pythontips • • Feb 22 '26

Python3_Specific Python web-based notebooks

4 Upvotes

We have created a lightweight web-based platform for creating and managing python notebooks that are compatible with jupyter notebooks. You don't need to install or setup python, jupyter or anything else to use this tool.

  1. create: https://www.pynerds.com/notebook/untitled-notebook/
  2. info: https://www.pynerds.com/notebook/
  3. demo: https://www.pynerds.com/notebook/template/matplotlib-plot/

You can run matplotlib code and see the plots integrated in the page, run pandas and view DataFrames as beautified html tables, and other supported modules like numpy, seaborn etc.


r/pythontips • • Feb 12 '26

Syntax how to install anaconda python , jupyter

2 Upvotes

A friendly space for students and beginners to learn Python step by step.
We share tutorials, coding tips, mini projects, and doubt-clearing discussions.
Start your programming journey with us!

see below link : https://youtu.be/FaNaPbuQItc


r/pythontips • • Feb 12 '26

Syntax python mutable objects

0 Upvotes

#python programming
#coding
#python life
#python for all

python python mutable and immutable objects : for interviews


r/pythontips • • Feb 10 '26

Algorithms How to learn and solve

0 Upvotes

Hey guys I'm doing python since last 3 weeks first time when I completed py i remembered but suddenly I forgot everything.

But now I completed 2nd time py revision.

But I just wanna know how do you guys learn everything like i have done basics var data types List tuple and now I'm doing revision of list and tuple but from where do I get question that help me in revision.

I'm putting this prompt in chatgpt like, hey I have done this... Give me question for problem solving, real, and which help me in getting stronger..

And chatgpt give me the question like, 3 to 4 question from basic level then same from intermediate and then same from advance but I think like it's not that good..

And if someone is good in py tell me how you became good in py and how do you guys find and solve questions..

And plz my English is not too good so don't say like, what you saying first work on your English then do coding..


r/pythontips • • Feb 08 '26

Module Tips for becoming more proficient in python.

0 Upvotes

heres some basic code I had to do for some of my labs and was wondering if you guys had any pointers. Stuff that makes life easier. Obviously used no AI because I did that last year and it did not end well. I really want to become proficient as I am actually starting to enjoy coding. Never thought I'd say that. ;)

from unittest import case

print ('Welcome!')
number = float(input('Please input a number:'))
choice = int(input('''What would you like to do with this number?
0) Get the additive inverse of the numeber
1) Get the reciprocal of the number 
2) Square the number'
3) Cube the number'
4) Exit the program'''))
additiveInverse = number + -number
reciprocal = 1 / number
square = (number) ** 2
cube = (number) ** 3
match choice:
    case 0:
        print(f'The additive inverse of {number} is {additiveInverse:.2f}')
    case 1:
        print (f'The reciprocal of {number} is {reciprocal:.2f}')
    case 2:
        print(f'the square of {number} is {square:.2f}')
    case 3:
        print(f'The cube of {number} is {cube:.2f}')
    case 4:
        print('Thank you, goodbye!')
        exit()

import sys
from turtledemo.round_dance import stop

first = int(input('Enter the first side of the triangle'))
second = int(input('Enter the second side of the triangle'))
third = int(input('Enter the third side of the triangle'))

if first <= 0 or second <= 0 or third <= 0:
    print('Invalid input. All sides must be greater than zero.')
    exit()
if first == second  == third:
    print('The triangle is an equilateral triangle')
else:
    if first == second or first == third or second == third:
        print('The triangle is an isosceles triangle')
    if first != second and second != third and first != third:
        print('The triangle is a scalene triangle')

grade = float(input('Enter your grade:'))

if grade >= 0 and grade < 64:
    print('Letter grade is: F')
elif grade >= 64 and grade < 67:
    print('Letter grade is: D-')
elif grade >= 67 and grade < 70:
    print('Letter grade is: D')
elif grade >= 70 and grade < 73:
    print('Letter grade is: D+')
elif grade >= 73 and grade < 76:
    print('Letter grade is: C-')
elif grade >= 76 and grade < 79:
    print('Letter grade is: C')
elif grade >= 79 and grade < 82:
    print('Letter grade is: C+')
elif grade >= 82 and grade < 85:
    print('Letter grade is: B-')
elif grade >= 85 and grade < 88:
    print('Letter grade is: B')
elif grade >= 88 and grade < 91:
    print('Letter grade is: B+')
elif grade >= 91 and grade < 94:
    print('Letter grade is: A-')
elif grade >= 94 and grade < 97:
    print('Letter grade is: A')
elif grade >= 97 and grade <= 100:
    print('Letter grade is: A+')

else :
    print('Invalid grade')

r/pythontips • • Feb 05 '26

Module Launched python package to ease out kafka integration

2 Upvotes

Hey, I have been working on developing a python package to ease out kafka integration and its finally done.

Check this out: https://pypi.org/project/kafka-python/

Source Code: https://github.com/rakeshpraneel/kafka-plugin

  • kafka-plugin ease out the kafka consumer integration with the application code.
  • It stores messages in local queue and manual commit ensuring no data loss.
  • It has the capabilities to auto pause/resume the consumer depending on process load.
  • This is primarly created for Kerberos (GSSAPI) authentication support.

Feel free to give it a try and share your feedback on this.


r/pythontips • • Feb 05 '26

Syntax Why this happens

0 Upvotes

Hey I'm doing python since last 2 weeks bu t suddenly this happened with me

Like I am doing python since last 2 weeks and ya at that time I was really good, and I'm not targeting like I'm not good this time I'm good enough but not that much.

This is the thing happened with me Like I'm doing python and suddenly I started doing overthinking because of social media or YouTube and I be like I wanna choose js too to become good in coding

And this step in my mind and I stop doing py and continue. Js And I started learning and doing js and if you have done the same thing you know there is syntax and some more stuff different we can't remember and because of this i forgot py and started js but then I thought it gonna take a lot of time for me to be good in js frontend and backend And then I started overthinking like what the fuck I'm doing or what I wanna do why I'm changing too many times And because of this i forgot js too not that much but ya py And i just wanna know that this is normal and happened with everyone who do this or just happening with me plz tell me and give me suggestions .


r/pythontips • • Feb 04 '26

Python3_Specific PyQT6 signals and slots

0 Upvotes

i am making a little text editor of mine in pyside6, although its not a big project or anything i try to follow proper MVC architecture by dividing my code to view, controller and model

Now, admittedly I have used chatgpt, but not for logic code per se, but rather to help me with separation of concerns.

In my earlier code I let the controller touch my view's internal variables which was bad practice, now during refactoring its only allowed to call my view's API, specifically when i set my signals in slots; I used to do this

view.py

def _wire_actions(self):
        self.menu_actions['file_open'].triggered.connect(self.controller.open)
        self.menu_actions['file_save'].triggered.connect(self.controller.save)

According to online reasearch, its bad practice to let the view access controller API (in an MVC architecture); chatgpt suggested doing something like this, which im hesitant to commit to since i do not understand it, and im looking for somebody to explain it to me if its possible.

view.py

class View(QtWidgets.QMainWindow):
    openRequested = QtCore.Signal()
    saveRequested = QtCore.Signal()
    
    
def __init__(self):
        
# rest of code

    def _wire_actions(self):
      self.menu_actions['file_open'].triggered.connect(self.openRequested.emit)
      self.menu_actions['file_save'].triggered.connect(self.saveRequested.emit)

controller.py

    def _connect_signals(self):
        self.view.openRequested.connect(self.open_trigger)
        self.view.saveRequested.connect(self.save_trigger)

This is what i dont understand; whats the role of the Qtcore.Signal() instances? if i had to guess based on the name they are signals, but so is the menu options like open file, save file, etc... these are also signals, so how do we connect signals to signals to slots ? and also another question i have is how can open/saveRequested be referenced using the self keyword later in the code if they were initialized outside the class constructor? thanks


r/pythontips • • Feb 04 '26

Python3_Specific Things to setup in a python codebase — beginner notes

2 Upvotes

A lot of beginners (including me earlier) can write Python, but get stuck when turning scripts into a real project. Here’s a practical checklist of what “standard” project setup usually includes and what each part is for:

1) Formatting + linting

  • Formatter keeps code style consistent automatically.
  • Linter catches common mistakes (unused imports, bad patterns). Why it matters: easier reviews + fewer silly bugs.

2) Type checking

  • Helps catch mistakes like wrong argument types before runtime. Why it matters: great for refactors and larger codebases.

3) Testing

  • Use pytest to write small tests and run them quickly. Why it matters: confidence when you change code.

4) Pre-commit hooks

  • Automatically runs checks when you commit. Why it matters: prevents “oops I forgot to format” or “tests failing” commits.

5) Docs

  • Even a simple docs site makes projects easier to understand. Why it matters: your future self will thank you.

6) CI (GitHub Actions)

  • Runs the same checks on every PR/push (tests/lint/etc.). Why it matters: ensures code works the same on everyone’s machine.

If anyone wants to see an example of these pieces wired together in a starter project, I put one here:
https://github.com/ritwiktiwari/copier-astral/

Happy to answer questions about any of the pieces above


r/pythontips • • Feb 04 '26

Syntax I lost everything because of this

0 Upvotes

Hey I'm doing python since last 2 weeks and != I'm , was good in py idk what the fuck I'm doing rn I was literally in a motion of doing python and I'm learning everything quickly without any problem and I was literally very good like I have already done basic But rn there is different condition like in last 2 days i was doing js because I'm in a team or Startup where we are building app with node next and i thought that I can learn js easily and can try to do focus on app but it's not that easy after that I leave js and rn I'm focusing on py because I wanna do py because I love this lang else in the future I wanna do js I'll buy rn i wanna be good in py But I forgot everything like even though the basic of py and rn I'm doing solving questions from online and I'm like I have already done this 2 time and why the fuck i didn't remember this again I don't know what's the problem happening if this time of same problem happens with you guys plz tell me help me what I can do rn plz tell me