#pythonsyntaxmagic wyniki wyszukiwania

Brak wyników dla „#pythonsyntaxmagic”

Answer:C). tho. This is due to Python's string slicing: Strings use 0-based indexing. The slice [2:5] extracts characters starting from index 2 (inclusive) up to, but not including, index 5 (exclusive). In the string "python": p is at index 0 y is at index 1 t is at index 2


strings aren't displayed with enclosing quotes. Hence, print("Python" * 0) is equivalent to print("") which just prints a blank line (not even the quotes.) That's the output.


i love how you can just do this in python and it can be extremely stupid or extremely genius depending on how you use it

maharshii's tweet image. i love how you can just do this in python and it can be extremely stupid or extremely genius depending on how you use it

Python has for loop syntax with else clause. They also have a while-else construct too. Would you use it? #python

nixcraft's tweet image. Python has for loop syntax with else clause. They also have a while-else construct too. Would you use it? #python

Handy 6-PAGE laminated guide is a concise desktop reference to key concepts behind #Python logic, syntax, and operation (importing other libraries, formatting output strings, creating classes, etc.): amzn.to/3yKagRJ ——— #coding #100DaysOfCode #DataScientists #DataScience

KirkDBorne's tweet image. Handy 6-PAGE laminated guide is a concise desktop reference to key concepts behind #Python logic, syntax, and operation (importing other libraries, formatting output strings, creating classes, etc.): amzn.to/3yKagRJ
———
#coding #100DaysOfCode #DataScientists #DataScience

Python's English-like syntax can be misleading. "or" doesn't work as many expect. BTW: there's a proposal to make this mistake a syntax error: github.com/python/cpython…

nedbat's tweet image. Python's English-like syntax can be misleading. "or" doesn't work as many expect.
BTW: there's a proposal to make this mistake a syntax error: github.com/python/cpython…

Handy 6-PAGE laminated guide is a concise desktop reference to key concepts behind #Python logic, syntax, and operation (importing other libraries, formatting output strings, creating classes, etc.): amzn.to/3yKagRJ ——— #coding #100DaysOfCode #DataScientists #DataScience

KirkDBorne's tweet image. Handy 6-PAGE laminated guide is a concise desktop reference to key concepts behind #Python logic, syntax, and operation (importing other libraries, formatting output strings, creating classes, etc.): amzn.to/3yKagRJ
———
#coding #100DaysOfCode #DataScientists #DataScience

Here is some Python 🐍 code with a bunch of interesting things going on: 📌 decorators 📌 callable classes 📌 custom operators 📌 “functional” function composition 📌 arbitrary args and kwargs Pick this code apart and study it! I'll explain it in a thread later 😉

mathsppblog's tweet image. Here is some Python 🐍 code with a bunch of interesting things going on:

📌 decorators
📌 callable classes
📌 custom operators
📌 “functional” function composition
📌 arbitrary args and kwargs

Pick this code apart and study it!

I'll explain it in a thread later 😉

Plot twist with #python generator comprehensions: the iteration expression is evaluated when the generator is made, but other expressions are evaluated when the iteration happens. Changing names can change results!🤯😳 docs.python.org/3/reference/ex…

nedbat's tweet image. Plot twist with #python generator comprehensions: the iteration expression is evaluated when the generator is made, but other expressions are evaluated when the iteration happens. Changing names can change results!🤯😳
docs.python.org/3/reference/ex…

When you write a function in #Python, you can make it accept any number of arguments or keyword arguments by using this special syntax: 🐍 * arg for any number of args 🐍 **kw for any number of keyword args

driscollis's tweet image. When you write a function in #Python, you can make it accept any number of arguments or keyword arguments by using this special syntax: 

🐍 * arg for any number of args
🐍 **kw for any number of keyword args

Did you know about the #Python Ellipsis object? It lets you write oddball code like this example:

driscollis's tweet image. Did you know about the #Python Ellipsis object?

It lets you write oddball code like this example:

Here's a cool Python 🐍 tip 💡! Use `...` in places where you haven't finished writing your code. For example, inside a function or a class!

mathsppblog's tweet image. Here's a cool Python 🐍 tip 💡!

Use `...` in places where you haven't finished writing your code.

For example, inside a function or a class!

A simple Python trick: Use triple quotes (""") to span strings over multiple lines. It makes up for a much cleaner code. string2 instead of string1 on the attached example.

svpino's tweet image. A simple Python trick:

Use triple quotes (""") to span strings over multiple lines. It makes up for a much cleaner code.

string2 instead of string1 on the attached example.

I was telling a friend that one cool feature from Python is list slice notation So instead of just posting the link I decided to do a brief explanation. [5 min] Python's regular array indexing as in multiple languages is: a[index] a = [0, 1, 2, 3, 4] a[0] == 0 1/12🧵


Python 🐍 Tip Negating positive expressions obfuscates your code. Instead of "if not x is y," do "if x is not y." (See the position of the negation?) It's an elementary, minuscule change, but it makes your code much easier to read and understand. And every bit counts.

svpino's tweet image. Python 🐍 Tip

Negating positive expressions obfuscates your code.

Instead of "if not x is y," do "if x is not y." (See the position of the negation?)

It's an elementary, minuscule change, but it makes your code much easier to read and understand.

And every bit counts.

This is ridiculous. I've been coding in Python 🐍 since 2014. Somehow I've always resisted embracing one of their most important principles. This is a short thread 🧵about idiomatic Python. 👇

svpino's tweet image. This is ridiculous.

I've been coding in Python 🐍 since 2014. Somehow I've always resisted embracing one of their most important principles. 

This is a short thread 🧵about idiomatic Python.

👇

handcalcs - a library to render Python calculation code automatically in Latex (+some extra magic allowing numeric substitutions into formula) -- via @omarsar0 github.com/connorferster/…


#python factlet: The any() and all() functions are like chains of "or" and "and": any([a, b, c]) ⇔ False or a or b or c all([a, b, c]) ⇔ True and a and b and c


Brak wyników dla „#pythonsyntaxmagic”

🔍 Dive into the world of Python syntax and witness the power it holds! 🚀 From conditional statements to loops and functions, this post will guide you through the essential building blocks of Python programming. 📚💻  #PythonSyntaxMagic #ProgrammingMagic #knowmerit #edtech

KnowMerit's tweet image. 🔍 Dive into the world of Python syntax and witness the power it holds! 🚀 From conditional statements to loops and functions, this post will guide you through the essential building blocks of Python programming. 📚💻  #PythonSyntaxMagic #ProgrammingMagic #knowmerit #edtech

Loading...

Something went wrong.


Something went wrong.


United States Trends