Notice: file_put_contents(): Write of 15775 bytes failed with errno=28 No space left on device in /var/www/tgoop/post.php on line 50
Python Learning@python_bds P.856
PYTHON_BDS Telegram 856
Top Python tricks for efficient programming

Strings

Trick 6: Reversing the string

a=”python”
print(“Reverse is”, a[::-1])

Output:
Reverse is nohtyp

Trick 7: Splitting the string

a="Python is the language of the future"
b=a.split()
print(b)

Output:
[‘Python’, ‘is’, ‘the’, ‘language’, ‘of’, 'the’, ‘future’]

Trick 8: Printing out multiple values of strings

print(“on”*3+’ ‘+”off”*2)

Output:
ononon offoff

Trick 9: Creating a single string

a = [“I”, “am”, “not”, “available”]
print(“ “.join(a))

Output:
I am not available

Trick 10: Checking if two words are anagrams

from collections import Counter
def is_anagram(str1, str2):
return Counter(str1) == Counter(str2)
print(is_anagram(‘taste’, ‘state))
print(is_anagram(‘beach’, ‘peach’))

Output:
True
False
👍32



tgoop.com/python_bds/856
Create:
Last Update:

Top Python tricks for efficient programming

Strings

Trick 6: Reversing the string

a=”python”
print(“Reverse is”, a[::-1])

Output:
Reverse is nohtyp

Trick 7: Splitting the string

a="Python is the language of the future"
b=a.split()
print(b)

Output:
[‘Python’, ‘is’, ‘the’, ‘language’, ‘of’, 'the’, ‘future’]

Trick 8: Printing out multiple values of strings

print(“on”*3+’ ‘+”off”*2)

Output:
ononon offoff

Trick 9: Creating a single string

a = [“I”, “am”, “not”, “available”]
print(“ “.join(a))

Output:
I am not available

Trick 10: Checking if two words are anagrams

from collections import Counter
def is_anagram(str1, str2):
return Counter(str1) == Counter(str2)
print(is_anagram(‘taste’, ‘state))
print(is_anagram(‘beach’, ‘peach’))

Output:
True
False

BY Python Learning


Share with your friend now:
tgoop.com/python_bds/856

View MORE
Open in Telegram


Telegram News

Date: |

But a Telegram statement also said: "Any requests related to political censorship or limiting human rights such as the rights to free speech or assembly are not and will not be considered." While the character limit is 255, try to fit into 200 characters. This way, users will be able to take in your text fast and efficiently. Reveal the essence of your channel and provide contact information. For example, you can add a bot name, link to your pricing plans, etc. Private channels are only accessible to subscribers and don’t appear in public searches. To join a private channel, you need to receive a link from the owner (administrator). A private channel is an excellent solution for companies and teams. You can also use this type of channel to write down personal notes, reflections, etc. By the way, you can make your private channel public at any moment. While some crypto traders move toward screaming as a coping mechanism, many mental health experts have argued that “scream therapy” is pseudoscience. Scientific research or no, it obviously feels good. Telegram users themselves will be able to flag and report potentially false content.
from us


Telegram Python Learning
FROM American