Masthash

#PythonTips

Oleg Sinavski
4 months ago

Python 🐍 coders! A tutorial on how to refactor side effects out of your code - nice visuals and a bunch of links to other resources on the topic.
https://levelup.gitconnected.com/dealing-with-side-effects-step-by-step-76c100426b89

#Python #CodeQuality #SideEffects #PythonTips #PythonCareer #CleanCode #SoftwareEngineering

LinuxCapable
5 months ago

Python, a dynamic and versatile programming language, is celebrated for its powerful string manipulation capabilities. Among these, string concatenation—a fundamental operation in Python—stands out as a critical skill for developers.
#Python #PythonProgramming #PythonCode #PythonDeveloper #DataScience #MachineLearning #AI #WebDevelopment #PythonTips #Pythondev #Opensource #PythonCommunity

https://www.linuxcapable.com/python-string-concatenation/

Just published an article on @towardsdatascience about breaking #Python performance bottlenecks with aiomultiprocess!💡 Check out my practical guide filled with code examples and best practices.
https://towardsdatascience.com/supercharge-your-python-asyncio-with-aiomultiprocess-a-comprehensive-guide-571ee0e2f416
#DataScience #MachineLearning #Concurrency #PythonTips

Luis Márquez :verified:
10 months ago

🐍 #PythonTips El método sort() ordena los elementos de una lista en orden ascendente o descendente.

Es muy útil para organizar datos y hacer búsquedas más rápidas #Python #programación

RecursiveNeuron :verified:
10 months ago
Harim Britto
10 months ago

Bom dia meu povo!

Tô aproveitando as férias pra começar a mexer em algumas coisas do #Python.

Surgiu um problema. Quando faço o login e senha pelo selenium, fico preso naquela tela de https e não consigo passar adiante.

Alguma dica?

#mastohelp #pythontips #bolhaDev

Tela de alerta do modo https do firefox.
RecursiveNeuron :verified:
10 months ago

Python quiz:

What is the output of this code?

#python #python3 #pythonprogramming #pythonquiz #pythontips

RecursiveNeuron :verified:
10 months ago

Python quiz

a. [1, 4]
[1, 4, 5]

b. [1, 4, 5]
[1, 4, 5]

c. [1, 4]
[1, 4]

#python #pythonprogramming
#pythontips #programmer #Python3 #pythonquiz

RecursiveNeuron :verified:
11 months ago

🐍 "else" statement can be used in both for loops and while loops also

How does it work?

▶️ Executed only if the loop completes normally

▶️ If the loop is terminated by a "break" statement,"else" block won't be executed

Example syntax:

####
for i in range(10):
print(i)
else:
print("for loop ended without break ")
####

This will print 0 to 9 then prints the "for loop ended without break"

--

▶️ In this code snippet(of the image), we generate random number(n) between 1 to 10.

▶️ We loop through the list

▶️ If the "n" matches with the list's index,it will "break" the loop. In that case it won't execute else

▶️ If the 'n' didn't match with any index,it will execute "else"

#python #pythonprogramming
#pythontips #python3

RecursiveNeuron :verified:
11 months ago

🌀What is wrong with the following python code snippet

#▪️▪️▪️
l =["c"
"py",
"js"
]
#▪️▪️▪️

We missed the comma after "c". The python will concatenate it with "py". Resulting in ["cpy","js"].

#python #pythontips #pythonprogramming #Python3

RecursiveNeuron :verified:
11 months ago

Simple python quiz

A. Line number 2 has invalid syntax. It should be "quiz[2]"

B. It will print ('hello', 'world')

C. Linux number 1 will give an error, we can't mix string with integer in tuple

#python #pythonprogramming
#PythonTips #pythoncoding #pythoninterviews

RecursiveNeuron :verified:
11 months ago

When and how to use the python "async" feature properly? -written by @guilatrova

▶️ Async only makes sense if you're doing IO

▶️ ZERO benefit in using async to stuff like CPU intensive work

Read more about it here

https://guicommits.com/effective-python-async-like-a-pro/

#async #Python #python3 #programming
#PythonProgrammer #pythonlessons #pythontutorial #pythontips

DeaDSouL :fedora:
1 year ago

Since most of the resources in python need to be closed, so stop trying to close them manually. Instead, use their context manager.

#PythonTips #Python #Python3 #Coding #Tips

DeaDSouL :fedora:
1 year ago

When you're working with files use `with`

#PythonTips #Python #Python3 #Coding #Tips