Erik (@erikyan) header
Erik (@erikyan) profile picture

Writer, Python instructor. Learn Python @ https://xitter.cf/t.co/chZZ9TnCVF

Amsterdam, The Netherlands
Joined February 2009
Python has some pretty nifty string functions. Here are some examples!
1
2
17
1,564
Want to swap two variables? Python makes it incredibly easy thanks to tuple unpacking! a = 5 b = 10 a, b = b, a
8
970
💡 Do you know #Python’s any() and all() functions? These are powerful tools for evaluating iterables! any() returns True if at least one element of an iterable is true. all() returns True only if all elements of an iterable are true.
1
2
716
👀 Use Python’s built-in help() function! It's an interactive way to explore documentation and learn more about Python objects and modules in the Python REPL! 📚 Examples: help(str) import os help(os) help(os.path) etc.
1
1
579
One notable change: you can use the same quotes inside a nested f-string: >>> f"Quotes inside a nested f-string: {"a string"}" 'Quotes inside a nested f-string now: a string' I'm not sure what to think of this yet...
1
290
What does the teams variable look like after this? #Python #quiz
488
After a few years of using Windows + Linux (dual boot), I returned to MacOS (Macbook Pro). Do you have any tips, tricks, or cool software I need to know about as a software developer?
3
2
394
What's the output of this code? Leave your answer in the comments! #Python #quiz
2
1
6
483
Replying to @lchtvrkrsldng
@lchtvrkrsldng waarom precies over Assendelft en Krommenie als het er ook omheen kan? En dat dan elke paar minuten op 600m hoog?
2
159
As an experiment, I added an AI assistant to all the paid courses on Python Land. The assistant knows the content of the page you're on. So you can ask it to modify code for you, further explain things, expand on a topic, etcetera. I'm super excited about this stuff enhancing our lives! #Python #learning #ChatGPT
2
1
1
5
384
If you want to try it for free, you can navigate to one of the free sample lessons. Each course has at least a handful of sample lessons to pick from.
3
162
If you’ve been exploring the fascinating world of AI and generative AI (like ChatGPT), you’ve undoubtedly run into the term Python. So what exactly is Python, and why is it often linked with AI? Should you learn Python? 👇 #ChatGPT #ArtificialIntelligence #Python
1
1
4
327
In some form or another, Python is used a lot in the AI world: 1) There’s the AI that generates (and runs) Python code. 2) Python can use AI and machine learning libraries to create cool products. 3) Python can call APIs to build upon existing AI models.
1
5
195
My next programming language to learn is...
80%Python
0%Go
10%JavaScript/Typescript
10%Something else (comment!)
10 votes • Final results
1
2
2
188
Installing #Python packages system-wide can cause a lot of troubles once you upgrade your Python installation in the future. You can use pipx to save you from the drama that's usually involved with system-wide packages! Read about it here 👇 python.land/virtual-environm…
2
3
287
With Python, we can return multiple values at once. All you need to do is list your values after the return statement, separated by commas. Click the link to try it interactively: crumb.sh/YVLsjts5j93
1
2
4
353
What we are actually returning is a Python tuple. And if you’re wondering whether you can return more than two values this way: yes, you can! You can read more about it in my article here: python.land/return-multiple-…
1
190
What is the most impressive thing you've used Python for or seen Python being used for? This can be anything from a small-scale library that impressed you to large projects or whatever else it is that impressed you most. #AskTwitter #Python #pythonprogramming
1
4
274
Exception handling in #Python is the process of identifying and responding to errors in a program. In other words, it is a way to deal with errors that might occur in your program. Here's a TL;DR of exception handling
1
2
5
450
All built-in, non-system-exiting exceptions are derived from the Exception class in Python. Exceptions have their own, descriptive names. For example, if you try to divide a number by zero, you will get a ZeroDivisionError exception.
1
32