python

Back Open Paginator
16.09.2025 04:55
linuxgal (@linuxgal@techhub.social)

Print the longest and shortest lines in a text file with #Python #12

#!/usr/bin/python3
with open("kjv.txt") as file:
print("Shortest verse: ",min(file,key=len))
with open("kjv.txt") as file:
print("Longest verse: ",max(file,key=len))





Show Original Post


16.09.2025 04:01
stevensanderson (@stevensanderson@mstdn.social)

Here are some links to different resources, the lists continue to grow.

#LLM app.dotadda.io/teams/5161c3d6-

#RStats app.dotadda.io/teams/bad2fd50-

#Python app.dotadda.io/teams/ab732481-

I use DoTadda Dots dotadda.io




Show Original Post


16.09.2025 03:47
fencepost (@fencepost@infosec.exchange)

Huh. #til that a) TI makes a calculator that runs #Python code, b) #CircuitPython is a thing - and it's from adafruit, though that's in part their packaging of MicroPython, c) my wondering which version it's based on is probably completely silly (or stupid) seeing as how Python 3 has been around longer than any kids likely to be using Python on "approved for school" devices like calculators (or at least longer than they've been using calculators)





Show Original Post


16.09.2025 03:19
rzeta0 (@rzeta0@mathstodon.xyz)

Although I've used python's matplotlib for years, it has always been a case of hacking together code snippets from the web.

Why? Because I don't think there is a unified, coherent, consistent design philosophy. If there is, I have never found it in all these years.

I keep reading that the Grammar of Graphics is the solution - an actually designed framework which has been implemented first and foremost in R, but python implementations exist too.

What do people think?

I'd welcome your thoughts before I invest time in learning some grammar of graphics and maybe trying a library like plotnine.

Are my expectations of Grammar of Graphics too high?

cc @nrennie

#python #R #ggplot2 #grammarofgraphics #visualisation #dataviz




Show Original Post


16.09.2025 02:41
linuxgal (@linuxgal@techhub.social)

Random band name generator with #Python #11

#!/usr/bin/python3
import random
with open("band.txt") as f:
words = [w.strip() for w in f if w.strip()]
def make_band_name():
n = random.choice([2, 3])
return " ".join(random.sample(words, n))
for _ in range(10):
print(make_band_name())

Surf Spooky Baby
Contaminated Digestion Tango
Free Pistols
Arthur We're Beat
Carnage Bull Mogen
Throwing Breast
Cool Balls
Vomit Liberty Beer
Charlie Death
Cheesecake Style




Show Original Post


16.09.2025 01:34
qiita (@qiita@rss-mstdn.studiofreesia.com)

Azure AI Document Intelligenceの前処理:Word/Excelのルビ(ふりがな)を除去する
qiita.com/abachan/items/27e870

#qiita #Python #Windows #Azure #ライブラリ #DocumentIntelligence




Show Original Post


16.09.2025 01:05
pythonbrasil (@pythonbrasil@pynews.com.br)

As inscrições para os tutoriais da Python Brasil 2025 abrem dia 22 de setembro, às 8h da manhã 🐍 🔥 E serão realizadas pelo Eventbrite (mesmo link dos ingressos de palestras)

Tutoriais são atividades gratuitas, e você pode se inscrever em mais de um tutorial (desde que os horários não sejam conflitantes).

Confira a programação 📅 e planeje com calma em quais dessas atividades incríveis você quer participar ♥️

talks.python.org.br/pythonbras

#python #pythonbrasil #bolhadev





Show Original Post


16.09.2025 00:58
rye (@rye@ioc.exchange)

Let's see if we can get a local python group going.
More to follow.
#python




Show Original Post


16.09.2025 00:42
habr (@habr@zhub.link)

Что такое эмбеддинги и как с ними работать. Вводная для начинающих

В этой статье будет рассказано об эмббедингах и методах работы с ними. Расскажу немного математики и приведу много примеров на Python. 🔥 Начинаем? 🔥

habr.com/ru/articles/947216/

#nlp #python #embeddings #что_такое_эмбеддинги




Show Original Post


16.09.2025 00:34
r (@r@bsky.brid.gy)

The package for computing periods of algebraic varieties, relying on Picard-Lefschetz theory, by E. Pichon-Pharabod now runs in #Python using the modularized distributions of the #SageMath library provided by the passagemath project. github.com/ericpipha/le...

GitHub - ericpipha/lefschetz-f...




Show Original Post


16.09.2025 00:20
linuxgal (@linuxgal@techhub.social)

Calculate Easter for 1900-2368 with #Python #86

#!/usr/bin/python3
import sys
y=int(sys.argv[1]);c=y//100;n=y-19*(y//19);k=(c-17)//25
i=c-c//4-(c-k)//3+19*n+15;i-=30*(i//30)
i-=(i//28)*(1-(i//28))*(29//(i+1))*((21-n)//11)
j=y+y//4+i+2-c+c//4;j-=7*(j//7)
l=i-j;m=3+(l+40)//44;d=l+28-31*(m//4)
print(f"{m}/{d}/{y}")





Show Original Post


15.09.2025 23:27
veronica (@veronica@mastodon.online)

When I write tests for code, I often include references to TV or books or other such things.

If I need a text string, I rarely do "Hello World". I used to do "Hello Kitty" but these days I usually use "Hi Bob" (from For All Mankind). I even added a test API header "X-Hi: Bob" the other day. 😁

For errors I often go with "Out of cheese error" or "Divide by cucumber error" from Discworld.

#Code #Python #Pytest #SciFi #Discworld




Show Original Post


1 ...1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 ...1551
UP