#python function
Explore tagged Tumblr posts
codeonedigest · 2 years ago
Text
0 notes
doubledaybooks · 5 months ago
Text
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
These are the vibes I THE WHYTE PYTHON WORLD TOUR brings to the function bookshelf.
It's Spinal Tap meets Austin Powers.
It's an 80s themed wrestling duo alarming the interviewer.
It's Lorelei Gilmore Reading THE DIRT.
It's Ozzy Osbourne on reality TV.
It's "The Wind of Change" being used as a political battle cry.
Get ready for the world tour...
340 notes · View notes
froget-me-nots · 25 days ago
Text
Tumblr media Tumblr media
deskpet mikey :)
Tumblr media
60 notes · View notes
track-maniac · 9 months ago
Text
Feeling inspired by a post I saw a few months ago, I programmed a simple game of tic-tac-toe in python, in a single expression. Like regular functional programming, this means I can't mutate variables. But more than functional programming, this also means I can't
Declare variables at all
Declare functions
Use most loops and branch structures
The resulting program is 1730 characters long after removing all the non-strictly necessary whitespace and contains "lambda" 9 times.
The players are asked where they want to play using a number for each cell, in the configuration of a standard numpad. The program checks for invalid input too.
Source code under the cut
(lambda grid,toggle,players,cells_filled,print_grid,check_victory,ask_xy,validate_input,the_game:(lambda victor:print('=====\n'+('Draw.'if victor is None else f"{victor} wins!")))(the_game(grid,players,cells_filled,toggle,print_grid,check_victory,ask_xy,validate_input,the_game)))([[7,8,9],[4,5,6],[1,2,3]],True,['X','O'],0,lambda grid:print('\n'+'\n'.join(' '.join(map(str,ligne))for ligne in grid)),lambda grid,players:([player for player in players if any(set(grid[i][col]for i in[0,1,2])=={player}for col in[0,1,2])or any(set(grid[row])=={player}for row in[0,1,2])or set(grid[i][i]for i in[0,1,2])=={player}or set(grid[i][2-i]for i in[0,1,2])=={player}]+[None])[0],lambda players,toggle,grid,ask_xy,validate_input:validate_input(input(f"{players[toggle]}, place your symbol: "),grid,players,toggle,ask_xy,validate_input),lambda selection,grid,players,toggle,ask_xy,validate_input:(lambda selection,grid,players,toggle,ask_xy,validate_input:(selection%3,2-selection//3)if grid[2-selection//3][selection%3]not in players else ask_xy(players,toggle,grid,ask_xy,validate_input))(int(selection)-1,grid,players,toggle,ask_xy,validate_input)if len(selection)==1 and'0'<selection<='9'else ask_xy(players,toggle,grid,ask_xy,validate_input),lambda grid,players,cells_filled,toggle,print_grid,check_victory,ask_xy,validate_input,the_game:(print_grid(grid),the_game((lambda players,toggle,xy,grid:[[players[not toggle]if(j,i)==xy else grid[i][j]for j in[0,1,2]]for i in[0,1,2]])(players,toggle,ask_xy(players,not toggle,grid,ask_xy,validate_input),grid),players,cells_filled+1,not toggle,print_grid,check_victory,ask_xy,validate_input,the_game)if check_victory(grid,players)is None and cells_filled<9 else check_victory(grid,players))[1])
If you can't read any of this, don't worry, I can't either.
You can find the original code and a slightly more readable version on my gitlab: https://gitlab.com/Rijaja/gaae/-/tree/main/tttaae (but careful, the game is in French)
96 notes · View notes
johnono · 5 months ago
Text
I'm gonna start working on my sims 4 radqueer script mod again
15 notes · View notes
moose-mousse · 4 months ago
Text
I am writing in python rather than the pre 89 C shitshow at work right now..
And... I am just enjoying mixing function and object oriented design. Procedural mixed with imperative.
Just... making complex machines by swimming through the wonderfull sea of code in a modern langauge
9 notes · View notes
msharkness · 4 months ago
Text
i've spent 1.5 years studying and achieving a level of C/C++ literacy to go to a class, which is really cool, basis of machine learning and genetic based algorithms and i am a sucker for biology but we're applying those in python. what sucks is that now my brain and hands literally itch to put semicolons and curly brackets and indent the code to my needs and implement methods and functions when python doesn't even use those :( and now i can do more powerful things but the code looks like we've just discovered how to paint caves with our fingers
4 notes · View notes
mutter-official · 5 months ago
Text
python baby PLEEEEAAAAASEEEEE add generics. it would make my typehinting life SOOOOOO much easier
5 notes · View notes
crescentmp3 · 10 months ago
Text
speaking as a previous learner of C, THIS IS THE ONE MOST BEAUTIFUL THING I'VE EVER SEEN
Tumblr media
7 notes · View notes
elkkiel · 8 months ago
Text
I have a new idea for the wip list that will likely actually get made at some point, but I need to learn programming in Python first smh my head
5 notes · View notes
sevenfactorial · 4 months ago
Text
This morning I misread the theorem on the board and thought it said subset instead of subspace, which was rather troubling since we used convexity in the argument. Naturally, I ask what guarantees convexity and the professor pointed out subspace so cool. Great.
But he also said "where did you pick that up? Off the street?"
Because yeah, you can use a convex set instead of subspace. But it was such an unexpected question, phrased in such an unexpected way.
4 notes · View notes
one-shitpost-a-day · 4 months ago
Text
it may surprise you to know that i AM in fact attempting to start my homework but i got carried away trying to read an article about wave function collapse algorithms
2 notes · View notes
slime-exe · 9 months ago
Note
hey...... slime.exe.................. the function print("reply") would print the word reply. because putting it in quotes makes it a string. thumbs up
-a python nerd
>>> print ("reply")
oh hello! i see i see thank you for the info!! (⁠人⁠ ⁠•͈⁠ᴗ⁠•͈⁠)
4 notes · View notes
quiggel · 10 months ago
Text
Turns out coding is like writing and drawing (I desperately want to do it but then while I’m doing it I’m like ugh I hate this).
2 notes · View notes
generallyunskilled · 2 years ago
Text
There’s something g so funny to me about consuming older comedy for the first time and discovering how long we’ve been making jokes about things. Like when I was 15 my social studies teacher put on Monty Python and The Holy Grail as the “end of year, exam review is over, I don’t wanna teach anymore” movie and I remember hearing some of the jokes and being mad surprised about them. I just remember going to myself “this is from the sixties? I didn’t think you were allowed to talk about eating pussy in movies back then?” Same goes for most Monty Python stuff tbh. I always knew it was rather lewd stuff, and I had always associated it with the 80s, since I was used to that being raunchy comedy times. But I got hit with that 1975 release date and went “okay I was a little off on the time there but STILL!”
And I still get times like that. Like I know dick jokes are timeless, but I recall seeing Pompeii graffiti and finding other non penis jokes surprisingly modern seeming. Finding 69 jokes in a Navy ID for a ship cat from the 40s. I dunno, something about the way we’ve always been making dirty jokes but also the way we seem to still treat dirty jokes like they’re a new thing pushing the envelope.
9 notes · View notes
qrevo · 1 year ago
Text
holy shit python allows me to turn string variables trans
Tumblr media
3 notes · View notes