Snippets Collections
function palindrome(str) {
    const alphanumericOnly = str
        // 1) Lowercase the input
        .toLowerCase()
        // 2) Strip out non-alphanumeric characters
        .match(/[a-z0-9]/g);
        
    // 3) return string === reversedString
    return alphanumericOnly.join('') ===
        alphanumericOnly.reverse().join('');
}



palindrome("eye");

n = 2

s ="Programming"

print(s * n) # ProgrammingProgramming
This method gets vowels (‘a’, ‘e’, ‘i’, ‘o’, ‘u’) found in a string.
   
#make a function:
def get_vowels(string):

#return is the keyword which means function have to return value: 
 return [each for each in string if each in 'aeiou']


#assign the words and function will return vowels words.
get_vowels('foobar') # ['o', 'o', 'a']


get_vowels('gym') # []
#use print command
1.print (“Mary had a little lamb.”)
2.print (“I am 19 years old.”)
def byte_size(string):




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


  


 


byte_size('😀’) # 4
byte_size('Hello World') # 11
#assign a value to a variable:
types_of_people = 10 
# make a string using variable name:
X = f “there are {types_of_people} types of people.”

Output:
There are 10 types of people
bookmark
dashboard

Tue Aug 04 2020 19:25:25 GMT+0000 (UTC) https://www.freecodecamp.org/news/freecodecamp-palindrome-checker-walkthrough/

#javascript #strings #arrays
bookmark
dashboard

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

#python #python #strings
bookmark
dashboard

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

#python #python #strings #vowels #function
bookmark
dashboard

Tue Mar 31 2020 11:27:37 GMT+0000 (UTC)

#python #python #printfunction #strings
bookmark
dashboard

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

#python #python #len #bytesize #strings
bookmark
dashboard

Mon Mar 30 2020 10:16:54 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python ##python #strings #comments

Save snippets that work with our extensions

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