Snippets Collections
def byte_size(string):

  return(len(string.encode('utf-8')))

byte_size('😀’) # 4
byte_size('Hello World') # 11
#define a function 
 Def cube(num)
      #write the formula of cube
      return num*num*num
     #give the number to calculate the cube 
     cube(3)
   # print the cube of that number simply by using print command
    print(cube(3))
     “return” keyword means that function have to return          value
#define function
defall_unique(lst):

   return len(lst) == len(set(lst))
   
x = [1,1,2,2,3,2,3,4,5,6]


y = [1,2,3,4,5]


all_unique(x) # False
all_unique(y) # True
bookmark
dashboard

Mon Apr 20 2020 13:45:46 GMT+0000 (UTC) https://towardsdatascience.com/30-helpful-python-snippets-that-you-can-learn-in-30-seconds-or-less-69bb49204172

#python #python #function #bytesize #return
bookmark
dashboard

Mon Apr 20 2020 13:32:07 GMT+0000 (UTC) https://www.youtube.com/watch?v=rfscVS0vtbw&t=5s

#python #python #function #return
bookmark
dashboard

Tue Mar 31 2020 11:40:31 GMT+0000 (UTC) https://towardsdatascience.com/30-helpful-python-snippets-that-you-can-learn-in-30-seconds-or-less-69bb49204172

#python #python #function #return #allunique

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension