Python is one of the most preferred languages out there. Its brevity and high readability makes it so popular among all programmers.
So here are few of the tips and tricks you can use to bring up your Python programming game.
x, y = 10, 20
print(x, y)
x, y = y, x
print(x, y
a =”GeeksForGeeks”
print(“Reverse is”, a[::-1])
n = 10
result = 1 < n < 20
print(result)
result = 1 > n <= 9
print(result)
class MyName:
Geeks, For, Geeks = range(3)
print(MyName.Geeks)
print(MyName.For)
print(MyName.Geeks)
from collections import Counter
def is_anagram(str1, str2):
return Counter(str1) == Counter(str2)
print(is_anagram(‘geek’, ‘eegk’))
print(is_anagram(‘geek’, ‘peek’))