Write a function “ssnChecker” that takes a string “s” and validates if the string is in a valid social security number format (999-99-9999). The function must return a Boolean value (True or False).
def ssnChecker(s):
if len(s)==13:
for i in range(len(s)):
if i==0:
if s[i]!="(":
return False
elif (i>=1 and i<=3) or (i>=5 and i<=6) or (i>=8 and i<=11):
if not (s[i]>='0' and s[i]<='9'):
return False
elif i==12:
if s[i]!=")":
return False
else:
if s[i]!="-":
return False
return True
else:
return False
# Testing
print(ssnChecker("(999-99-9999)"))
print(ssnChecker("(999-99-999"))



Write a function “ssnChecker” that takes a string “s” and validates if the string is in...
Write a function is_mirror(s) that takes as input a string s and returns True if s is a mirrored string (i.e., a string that could have been produced by your mirror function) and False otherwise. Examples: >>> is_mirror('baconnocab') result: True >>> is_mirror('baconnoca') result: False Warning Your function should return a boolean value – either True or False, without any quotes around them. If you see quotes around the result when you make the calls above from the console, you must...
The istime function takes a string as its parameter and return True if the string represent a valid time in the format of hh:mm or hh-mm format. It returns False otherwise. For example, istime("12:30"), istime("04-15"), istime("02:09") all return True. istime("ab:cd"), istime("1234"), and istime("04-98") all return False. It's critical that you include test case code to show proper testing.
C++ Programming: Write a function that takes in a C++-style string s (from #include ), as well as an integer n, and then returns true if any substring of length n in s repeats itself, and false otherwise. For example, if s is "toe-to-toe" and n is 3, then the function would return true since "toe" occurs twice within s. However, if n were 4, the function would return false. As a second example, if s is "singing" and n...
Password Validation Write a program called PasswordValidationYourLastName that validates a new password, following these guidelines: Must be at least 8 characters Must have at least 1 uppercase letter Must have at least 1 lowercase letter Must have at least 1 digit Write a program that asks for a password, and then asks again to confirm it (you can use the scanner or JOptionPane). Pass those two Strings to a method called validatePassword( ). Your validatePassword( ) should return a boolean...
Write a function named "find_key" that takes a key-value store as a parameter with strings as keys and integers as values. The function returns a boolean representing true if the string "focus" is in the input as a key, false otherwise(javascript)
Write the function deep_contains. It takes as input a number and a list. That list might contain lists as elements, and those lists might contain lists, etc. The deep_contains' function should return a Boolean indicating whether the number is contained inputted list, or a sublist of it, or a sublist of that, and so forth. For example: deep_contains (3, (1,3,5]) returns True deep_contains(3, 11, [3,5]]) returns True deep_contains (3, 1, [[3,4],5),6]) returns True deep_contains (2, (1,3,5]) returns False This function...
Write a function that takes two string parameters which represent the names of two people and returns True if the people are a "match" and False if they are not. Determining Love Total all the ‘L’s ‘O’s ‘V’s and ‘E’s (uppercase and lowercase) found in each of their names. If the number of LOVE letters combined between both their names is odd, return True. If the number of LOVE letter combined between both their names is even, return False. *...
CODIO python problem Write a function isRed() that accepts a string parameter and looks for the presence of the word ‘red’ in the string. If it is found, return boolean True otherwise False. Finally output the result of calling the function with the value in text.
Haskell Functional Programming Language: Write a function nestedParens that takes a string argument and returns true if it is a nesting of zero or more pairs of parentheses, e.g. "((()))" should return True ; "()()" or "(()))" should return False . Use recursion for this problem. nestedParens :: String -> Bool
javascript-Write a function named "json_average" that takes a JSON formatted string as a parameter in the format of an array of objects where each object has keys "mass", "density", "temperature", and "velocity" and each key maps to a floating point number. This function should return the average "velocity" of all the objects in the array as a JSON string in the format {"velocity": }