Answers for "Tips & Tricks in python"

0

Tips & Tricks in python

class MyName:
    Geeks, For, Geeks = range(3)
  
print(MyName.Geeks)
print(MyName.For)
print(MyName.Geeks)
Posted by: Guest on August-03-2021
0

Tips & Tricks in python

import sys
x = 1
print(sys.getsizeof(x))
Posted by: Guest on August-03-2021
0

Tips & Tricks in python

from collections import Counter
def is_anagram(str1, str2):
     return Counter(str1) == Counter(str2)
  
# or without having to import anything 
def is_anagram(str1, str2): 
    return sorted(str1) == sorted(str2) 
  
print(is_anagram('geek', 'eegk'))
print(is_anagram('geek', 'peek'))    
Posted by: Guest on August-03-2021
0

Tips & Tricks in python

test = [1, 2, 3, 4, 2, 2, 3, 1, 4, 4, 4]
print(max(set(test), key = test.count))
Posted by: Guest on August-03-2021

Python Answers by Framework

Browse Popular Code Answers by Language