• Aug 1, 2025 •AustinLeath
0 likes • 2 views
import re _proposal_regex = r'(?:(?:(IKE|ESP):)?[\w/]+(?:/NO_EXT_SEQ)?(?:, ?(IKE|ESP):[\w/]+(?:/NO_EXT_SEQ)?)*)?' _proposals_re = rf'(?P<proposals>{_proposal_regex}|)' pattern = rf'received proposals: {_proposals_re}' match = re.match(pattern, 'received proposals: ') print(match.group('proposals') if match else "No match") # Prints "No match"
• Nov 19, 2022 •CodeCatch
0 likes • 7 views
# function which return reverse of a string def isPalindrome(s): return s == s[::-1] # Driver code s = "malayalam" ans = isPalindrome(s) if ans: print("Yes") else: print("No")
• Jun 1, 2023 •CodeCatch
0 likes • 4 views
from colorama import init, Fore # Initialize colorama init() print(Fore.RED + "This text is in red color.") print(Fore.GREEN + "This text is in green color.") print(Fore.BLUE + "This text is in blue color.") # Reset colorama print(Fore.RESET + "This text is back to the default color.")
• Mar 10, 2021 •Skrome
import string def caesar(text, shift, alphabets): def shift_alphabet(alphabet): return alphabet[shift:] + alphabet[:shift] shifted_alphabets = tuple(map(shift_alphabet, alphabets)) final_alphabet = "".join(alphabets) final_shifted_alphabet = "".join(shifted_alphabets) table = str.maketrans(final_alphabet, final_shifted_alphabet) return text.translate(table) plain_text = "Hey Skrome, welcome to CodeCatch" print(caesar(plain_text, 8, [string.ascii_lowercase, string.ascii_uppercase, string.punctuation]))
0 likes • 1 view
#Loop back to this point once code finishes loop = 1 while (loop < 10): #All the questions that the program asks the user noun = input("Choose a noun: ") p_noun = input("Choose a plural noun: ") noun2 = input("Choose a noun: ") place = input("Name a place: ") adjective = input("Choose an adjective (Describing word): ") noun3 = input("Choose a noun: ") #Displays the story based on the users input print ("------------------------------------------") print ("Be kind to your",noun,"- footed", p_noun) print ("For a duck may be somebody's", noun2,",") print ("Be kind to your",p_noun,"in",place) print ("Where the weather is always",adjective,".") print () print ("You may think that is this the",noun3,",") print ("Well it is.") print ("------------------------------------------") #Loop back to "loop = 1" loop = loop + 1
• Sep 6, 2020 •C S
0 likes • 3 views
def Fibonacci(n): if n<0: print("Incorrect input") # First Fibonacci number is 0 elif n==1: return 0 # Second Fibonacci number is 1 elif n==2: return 1 else: return Fibonacci(n-1)+Fibonacci(n-2) # Driver Program print(Fibonacci(9))