Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Help me ! <3

Hi guys, can somebody help me with exercies?

I'm just really far from it (

\--------------------------------------------------------

In the corridor of length S, the floor needs to be painted.

After painting a part of the corridor with length L, A kg of paint was spent.

Write the code for calculating how many cans of paint are needed to

to repaint the corridor if the can of paint weighs 900 g?

Enter: the length of the corridor, the length of its painted part,

weight of spent paint.

Display the calculation result.

\--------------------------------------------------------

/r/JupyterNotebooks
https://redd.it/y33nrk
Does the Jupyter API allow using Jupyter from the CL?

Can you actually use Jupyter functionalities from the command line like executing or editing and re-executing line 3?

Or is the API just for basics like exporting a notebook into a Python script?

Thank you

/r/JupyterNotebooks
https://redd.it/y2djyl
Is it worth using the sitemap framework in a six-year Django website with 500,000 URLs?

I'm reflecting on it because it is necessary to use models and I have something like 19 models. So, Is it worth using Django's sitemap framework? If not, do you have a suggestion that fits Django?

/r/django
https://redd.it/y32x7q
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!

This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.

/r/Python
https://redd.it/y2jpp1
Real time collaboration whiteboard for Jupyter notebooks?

I'm finding a common scenario for remote data science meetings is that a data scientist screen shares their Jupyter notebook in Zoom or Hangouts, then proceeds to start scrolling down and explaining their results. Usually their font size is too small and somebody asks them to zoom in a little. When I ask questions about a plot or table, there's a lot of "can you scroll up a little, no too far, back down a little" before they get to the one of interest. If I want to point to an area of the plot or highlight a number in a table, I can annotate with Zoom but not Hangouts, and with Zoom the annotation locations are out of place once the notebook is scrolled.

It seems like there should be a way where the presenter can share their notebook as a collaborative whiteboard, with support for annotations that stay in place and the ability to save the annotated notebook content after the meeting is over. This would let each meeting participant highlight an area of interest that would be shown the rest of the participants ala Google Docs, except I don't even need the ability to have people edit the

/r/JupyterNotebooks
https://redd.it/vzsg09
New, free book from Al Sweigart: Python Programming Exercises, Gently Explained

Hello, I've released my new book "Python Programming Exercises, Gently Explained". You can read it for free at:

https://inventwithpython.com/pythongently

Description: Many books and websites have aggressive programming challenges for top coders. However, Python Programming Exercises, Gently Explained is for the rest of us. We want challenges that improve our coding skills, not leave us confused and discouraged. Other tutorials and books have taught you the basics of Python, but the 42 programming exercises in this book let you practice what you've learned. Selected for their simplicity, these programming problems include gentle explanations of the problem, the prerequisite coding concepts you’ll need to understand the solution, and helpful templates to put together the programs if you have trouble starting from scratch.

This is the perfect book for beginner and intermediate programmers who want to test their Python skills but aren’t ready to begin professional-level software development. You don’t need the frustration of being expected to create complex algorithms and computer science theory; you need a large set of programming challenges that meet you at your level, with gentle explanations.

/r/Python
https://redd.it/y38r6b
Starlite: v1.27.0 updates

Hi Pythonistas!

Been 3 weeks since my last post here and a lot of new stuff happened in Starlite land.

First off, lemme start with the usual intro for those who don't know what im talking about: Starlite is an ASGI (async Python) API framework. It started out as an alternative to FastAPI - built on the same foundations: the Starlette ASGI Kit and pydantic. It evolved and has been intensely developed over the past year+ and is now a sophisticated and powerful API framework with a vibrant community and several (currently 4) maintainers.

Note regarding the name: The framework is called Starlite to show the relation to Starlette. This was important to me when starting this project, although to be honest Starlite now uses Starlette only in several select places and is almost completely distinct.

With this part out of the way - lemme give some updates:

1. We implemented a new on_app_init hook that allow plugins to set all elements of application configuration (more on this lower).

2. Building on the point above, we updated the SQLAlchemyPlugin to now support creating a DB connection and injection sessions using dependency injection. This is completely optional, but it also allows using Starlite with SQLAlchemy as an

/r/Python
https://redd.it/y2w6fl
Instructor split us into teams to turn a percentage into a letter grade "using as few lines of code as possible"; here is the monstrosity our team came up with.

Had to share this because I thought it was funny; I'm currently in a programming 101 course at my university, and the challenge given today was to write a program which can turn an input percentage into a standard letter grade. He only specified "in as few lines as possible". Not sure if it is PEP compliant... any feedback?

grade = "A+" if (percentage := float(input("Enter the percentage grade: "))) >= 100 else "F"
if 60 <= percentage < 100: grade = chr(-int(percentage // 10) + 74) + '-', '', '+'((final_digit := int(percentage % 10)) >= 4) + (final_digit >= 7)
print(f"Your letter grade is {grade}!")

/r/Python
https://redd.it/y3dzhu
Having issues with flask behind httpd proxy

I'm unable to successfully pass static files from flask through httpd without having to have the root "/" proxies to my flask server which isn't an option as I have to proxy that elsewhere.

/r/flask
https://redd.it/y3hjl9
Let's assume I am making a web app that will be used in the real world outside of development. Is the admin page still meant to be used?

Imagine I have an e-commerce store and on the admin page I want to have graph displaying sales.

Is using the admin page for this kind of stuff the correct way or is the right way to do it different?

/r/django
https://redd.it/y3bfm9
Do you really need callback routes in flask?

Hi everyone, I recently started working on a new project that uses Flask for the backend. For this project, we need to interact with an external service(Netsuite): unfortunately, the calls to this service can take up to a couple of seconds to complete, and the external service seems to handle just a couple of requests in parallel. So we decided to implement a queue with redis(through the use of python rq) in order to limit the number of requests made to the external service. The problem is that we use this queue for almost every endpoint of the API: from my understanding(I'm kind of new to python and flask) since the jobs enqueued take a while to be processed, we are considering having a separate call for every endpoint(doubling, in fact, the number of total endpoints) in order to check on the status of the job. Is it really the only way to handle this type of situation in Flask?

I come from node.js, and there we use promises to handle asynchronous calls without blocking the server, but from some examples I've found online, that doesn't seem to be the preferred way of doing things in python. What would be the

/r/flask
https://redd.it/y3qf9r
Jupyter Notebook competition - 2 weeks left to enter!



Are you passionate about \#coding, \#DataScience or \#EarthObservation? 📷

Don't miss out on the chance to showcase your skills and develop new Jupyter Notebooks using \#Copernicus data, whilst also being in with a chance of winning cash 📷 prizes!

Sign up before 31 July at: https://notebook.wekeo.eu/

https://preview.redd.it/ddy750xg4bb91.png?width=1920&format=png&auto=webp&s=ac315546d7fa35fd8a99e1c834ef0d3aea3c877f

/r/JupyterNotebooks
https://redd.it/vxzbw3
Cloning a Django project from Git how to set up the environment

I just cloned a Django project from Github and I want to know how to set-up the project to run in my Pycharm IDE. Do I have to create a new venv? And how to download all of the external libraries in the Github project with PyCharm?

&#x200B;

Basically, I want to set it up to a point where I can run it.

/r/djangolearning
https://redd.it/y3vkmd
Moving from wsgi gunicorn to asgi gunicorn with uvicorn workers doubled my average response time in Django 4. Is this normal?

Basically, I'm wondering if this is par-for-the-course or if instead I have issues with my codebase that cause it to be slow when moving to `asgi`. What are other people's experience here? Did anyone get a speed up.

/r/django
https://redd.it/y3r8o7