#python Programming
Explore tagged Tumblr posts
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
Text
The Zen of Python
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one—and preferably only one—obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
#Tim Peters#a Python programmer#wrote this#poem#now-famous#python#python programming#coding#guiding principles for coding in Python#programming#computer science
57 notes
·
View notes
Text
Does anyone else have dreams about coding? Like I figure out my real world coding problems in my sleep, it's weird.
#codeblr#cosmickittytalk#dreams#learning programming#programming humor#csharp programming#programming#java#java programming#csharp#csharp is superior#python#python programming#sleep#coding
115 notes
·
View notes
Text
7 Common Mistakes to Avoid in Your Python Developer Interview
Let's explore how to prepare for Python developer interview or scrolling through endless Python developer interview questions and how to tackle Common Mistakes to Avoid in Your Python Developer Interview. Give a brief read: https://www.zupyak.com/p/4493963/t/7-common-mistakes-to-avoid-in-your-python-developer-interview
7 notes
·
View notes
Text
Programming Professor: "Ignore the warnings, it's not a problem."
#me when i dodge red flags like parkour#out of context as usual#college#university#quote blog#student#student life#dialogue#quotes#college quotes#university quotes#school#science#programming#engineering computations#python programming
8 notes
·
View notes
Video
youtube
Introduction of Python Programming by Prof .Yogesh Sahu
#youtube#programming#coding#python#python for beginners#computer science#it industry#python programming#sirtbhopal#bestengineeringcollegeinmp#education#best engineering college in bhopal
9 notes
·
View notes
Text
FreeCodeCamp recommend this Python course ...
youtube
Post #87: FreeCodeCamp, Beau Carnes, Ultimate Beginner's Python Course on YouTube by Dave Gray, 2023.
#programming#coding#coding is fun#i love coding#coding for kids#education#i love python#learning#i love programming#programming language#youtube#dave gray#python programming#python tutorial#Youtube
65 notes
·
View notes
Text

This is part of a new project I am doing for a Facebook app that can alert someone when there is suspicious activity on their account, and block people who post rude comments and hate speech using a BERT model I am training on a dataset of hate speech. It automatically blocks people who are really rude / mean and keeps your feed clean of spam. I am developing it right now for work and for @emoryvalentine14 to test out and maybe in the future I will make it public.
I love NLP :D Also I plan to host this server probably on Heroku or something after it is done.
#machine learning#artificial intelligence#python programming#programmer#programming#technology#coding#python#ai#python 3#social media#stopthehate#lgbtq community#lgbtqia#lgbtqplus#gender equality
74 notes
·
View notes
Text
#anxiety memes#programming meme#cs50#cs50p#python programming#python#programming#progblr#coding#codeblr
28 notes
·
View notes
Text
30th and 31st August 2023
(Yes 2 daily logs in a row)
Today's goals
Complete one past paper for bio
Finish chemistry homework
Finish the 8th question for physics worksheet
Read about gas exchange for bio
Revise projectile motion
Speed run Python course
Figure out personal learning plan for French
Break-down and simplify some tasks (simplifying tasks literally helps a lot if you have too many things going on)

what I did for self-care:
Listened to music
did some journalling
looked for some study motivation
tried to plan for tomorrow
read a book i like
Binge-watched some anime (also Zoro got shut down 😭😭😭 how can I keep track of my anime now)
"I'm sighing in my dreams"
how are you guys?!?
I forgot to check my school messages lmao (I do online school), I woke up late opened my laptop and sat there waiting for the teachers to reply to my messages. Guess who forgot yesterday and today are holidays? I DID! Honestly, I was so stressed out but I started by reading some bio, then did my chemistry homework. After that, I met up with my tutor and studied Enzymes with her. Then I sat down again to do some speed running, looked into a webinar for my French learning and self-care and gosh it's tiring to be a student!


#a level studyblr#online school#study inspo#a levels#desi studyblr#student life#chaotic academic aesthetic#chemistry#a level physics#a level chemistry#a level biology#planning#digital planner#indian studyblr#new studyblr#a level exams#codeblr#python programming#speedrun#frenchblr#french langblr#french language#notion aesthetic#notion#personal notes#aesthetic notion
64 notes
·
View notes
Text
Learning how to use tkinter in 2025 wish me luck
20 notes
·
View notes
Text
i made a simple python program that takes phrases from .txt files and smashes them together to make sentences. the files I use are my own diary entries and some public-domain books (with some headlines sprinkled in). it has three modes. my favorite uses sentiment analysis, letting users type the first sentence. I'd share the code, but it's part of my portfolio with my full legal name lol. Here's a sample inspired by a post by @tanadrin:
Bacteria has a soul. ruder and less. use. In and About. spot. the style of beard of Napoleon Campbell. There will be successful attempts Cau"tionry, n. (Scots Politicians will talk about Au`toco*her"er, Indie dev removes fall damage from BOON providence, And justify the An round, flat shell. also because their mom Monetary politics makes Monetary politics makes advantage of Monetary things contains 7,000 go hard on you tried to give it back. "How Miss Sweet Found "City "City Slave Every single
#mine#python#programming#python programming#if you want me to tell you the source of some texts just ask
7 notes
·
View notes
Text
When in doubt, scrape it out!
Come find me on TikTok!
#greek tumblr#greek posts#ελληνικο ποστ#ελληνικά#greek post#greek#ελληνικο tumblr#ελληνικο ταμπλρ#ελληνικα#python#python language#python programming#python ninja#python for web scraping#web scraping#web scraping api#python is fun#python is life
2 notes
·
View notes
Text
Why Python Will Thrive: Future Trends and Applications
Python has already made a significant impact in the tech world, and its trajectory for the future is even more promising. From its simplicity and versatility to its widespread use in cutting-edge technologies, Python is expected to continue thriving in the coming years. Considering the kind support of Python Course in Chennai Whatever your level of experience or reason for switching from another programming language, learning Python gets much more fun.
Let's explore why Python will remain at the forefront of software development and what trends and applications will contribute to its ongoing dominance.
1. Artificial Intelligence and Machine Learning
Python is already the go-to language for AI and machine learning, and its role in these fields is set to expand further. With powerful libraries such as TensorFlow, PyTorch, and Scikit-learn, Python simplifies the development of machine learning models and artificial intelligence applications. As more industries integrate AI for automation, personalization, and predictive analytics, Python will remain a core language for developing intelligent systems.
2. Data Science and Big Data
Data science is one of the most significant areas where Python has excelled. Libraries like Pandas, NumPy, and Matplotlib make data manipulation and visualization simple and efficient. As companies and organizations continue to generate and analyze vast amounts of data, Python’s ability to process, clean, and visualize big data will only become more critical. Additionally, Python’s compatibility with big data platforms like Hadoop and Apache Spark ensures that it will remain a major player in data-driven decision-making.
3. Web Development
Python’s role in web development is growing thanks to frameworks like Django and Flask, which provide robust, scalable, and secure solutions for building web applications. With the increasing demand for interactive websites and APIs, Python is well-positioned to continue serving as a top language for backend development. Its integration with cloud computing platforms will also fuel its growth in building modern web applications that scale efficiently.
4. Automation and Scripting
Automation is another area where Python excels. Developers use Python to automate tasks ranging from system administration to testing and deployment. With the rise of DevOps practices and the growing demand for workflow automation, Python’s role in streamlining repetitive processes will continue to grow. Businesses across industries will rely on Python to boost productivity, reduce errors, and optimize performance. With the aid of Best Online Training & Placement Programs, which offer comprehensive training and job placement support to anyone looking to develop their talents, it’s easier to learn this tool and advance your career.
5. Cybersecurity and Ethical Hacking
With cyber threats becoming increasingly sophisticated, cybersecurity is a critical concern for businesses worldwide. Python is widely used for penetration testing, vulnerability scanning, and threat detection due to its simplicity and effectiveness. Libraries like Scapy and PyCrypto make Python an excellent choice for ethical hacking and security professionals. As the need for robust cybersecurity measures increases, Python’s role in safeguarding digital assets will continue to thrive.
6. Internet of Things (IoT)
Python’s compatibility with microcontrollers and embedded systems makes it a strong contender in the growing field of IoT. Frameworks like MicroPython and CircuitPython enable developers to build IoT applications efficiently, whether for home automation, smart cities, or industrial systems. As the number of connected devices continues to rise, Python will remain a dominant language for creating scalable and reliable IoT solutions.
7. Cloud Computing and Serverless Architectures
The rise of cloud computing and serverless architectures has created new opportunities for Python. Cloud platforms like AWS, Google Cloud, and Microsoft Azure all support Python, allowing developers to build scalable and cost-efficient applications. With its flexibility and integration capabilities, Python is perfectly suited for developing cloud-based applications, serverless functions, and microservices.
8. Gaming and Virtual Reality
Python has long been used in game development, with libraries such as Pygame offering simple tools to create 2D games. However, as gaming and virtual reality (VR) technologies evolve, Python’s role in developing immersive experiences will grow. The language’s ease of use and integration with game engines will make it a popular choice for building gaming platforms, VR applications, and simulations.
9. Expanding Job Market
As Python’s applications continue to grow, so does the demand for Python developers. From startups to tech giants like Google, Facebook, and Amazon, companies across industries are seeking professionals who are proficient in Python. The increasing adoption of Python in various fields, including data science, AI, cybersecurity, and cloud computing, ensures a thriving job market for Python developers in the future.
10. Constant Evolution and Community Support
Python’s open-source nature means that it’s constantly evolving with new libraries, frameworks, and features. Its vibrant community of developers contributes to its growth and ensures that Python stays relevant to emerging trends and technologies. Whether it’s a new tool for AI or a breakthrough in web development, Python’s community is always working to improve the language and make it more efficient for developers.
Conclusion
Python’s future is bright, with its presence continuing to grow in AI, data science, automation, web development, and beyond. As industries become increasingly data-driven, automated, and connected, Python’s simplicity, versatility, and strong community support make it an ideal choice for developers. Whether you are a beginner looking to start your coding journey or a seasoned professional exploring new career opportunities, learning Python offers long-term benefits in a rapidly evolving tech landscape.
#python course#python training#python#technology#tech#python programming#python online training#python online course#python online classes#python certification
2 notes
·
View notes
Text
Mars Crater Study-1
This article was written as a practice exercise with reference to the information provided in the COURSERA course, specifically the Mars Crater Study.
=========================================
My program,
import pandas as pd
import statsmodels.formula.api as smf
# Set display format
pd.set_option('display.float_format', lambda x: '%.2f' % x)
# Read dataset
data = pd.read_csv('marscrater_pds.csv')
# Convert necessary variables to numeric format
data['DIAM_CIRCLE_IMAGE'] = pd.to_numeric(data['DIAM_CIRCLE_IMAGE'], errors='coerce')
data['DEPTH_RIMFLOOR_TOPOG'] = pd.to_numeric(data['DEPTH_RIMFLOOR_TOPOG'], errors='coerce')
# Perform basic linear regression analysis
print("OLS regression model for the association between crater diameter and depth")
reg1 = smf.ols('DEPTH_RIMFLOOR_TOPOG ~ DIAM_CIRCLE_IMAGE', data=data).fit()
print(reg1.summary())
=========================================
Output results,
Dep. Variable: DEPTH_RIMFLOOR_TOPOG
R-squared:0.344
Model: OLS
Adj. R-squared:0.344
Method:Least Squares
F-statistic:2.018e+05
Date:Thu, 27 Mar 2025
Prob (F-statistic):0.00
Time:14:58:20
Log-Likelihood:1.1503e+05
No. Observations:384343
AIC:-2.301e+05
Df Residuals:384341
BIC:-2.300e+05
Df Model: 1
Covariance Type:nonrobust
coef std err t P>|t| [0.025 0.975]
Intercept 0.0220 0.000 70.370 0.000 0.021 0.023
DIAM_CIRCLE_IMAGE
0.0151 3.37e-05 449.169 0.000 0.015 0.015
Omnibus:390327.615
Durbin-Watson:1.276
Prob(Omnibus):0.000
Jarque-Bera (JB):4086668077.223
Skew: -3.506
Prob(JB):0.00
Kurtosis:508.113
Cond. No.10.1
=========================================
Results Summary:
Regression Model Results:
R-squared: 0.344, indicating that the model explains approximately 34.4% of the variability in crater depth.
Regression Coefficient (DIAMCIRCLEIMAGE): 0.0151, meaning that for each unit increase in crater diameter, the depth increases by an average of 0.0151 units.
p-value: 0.000, indicating that the effect of diameter on depth is statistically significant.
Intercept: 0.0220, which is the predicted crater depth when the diameter is zero.
Conclusion:
The analysis shows a significant positive association between crater diameter and depth. While the model provides some explanatory power, other factors likely influence crater depth, and further exploration is recommended.
2 notes
·
View notes
Text
Programming Professor: "As engineers we don't have to worry about this."
#thank god#just like air resistance and friction#college#university#quote blog#student#student life#dialogue#quotes#college quotes#university quotes#school#science#programming#engineering computations#python programming
6 notes
·
View notes