def zigzag(text): Implement a function that takes a string and returns a new string that is a zig-zag rearrangement of it like the one in the examples below. Parameters: text is a string (no validation needed) Examples: zigzag('12345678') zigzag('123456789') zigzag('abcdefgh') zigzag('GeorgeMason') '18273645 '192837465' ahbgcfde" "GneoosragMe'
Q: 1. What is the difference between list and tuples in Python? 2. What are the conditions of naming a…
A: Lists Tuples Its are mutable Its are immutable its Consume more memory Its consume less…
Q: Implement the ShortenSpace() function. ShortenSpace() has a string parameter and updates the string…
A: Program description: string is a user-defined variable. ShortenSpace() is the function that replaces…
Q: class Line: '''write your codes below (don't forget to change the doc strings)''' def…
A: class Line(object): k=0 b=0 def __init__(self, k, b): self.k=k…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: As the programming language is not mentioned here, we are using PYTHON The code is given below with…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: The answer is given in the below step
Q: public static String reverseVowels(String text) Given a text string, create and return a new string…
A: Given data is shown below:
Q: Write a method called firstUnique() that takes a string as a parameter and finds the first…
A: EXPLANATION - The first step is traverse the particular string by just using the pointer. Then keep…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: In this problem, we need to design the code in the Python programming language. Input - Array of…
Q: Revorse the vewels def reverse_vowels(text): Given a text string, create and return a new string…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: In this problem, we need to design the code in the Python programming language. Input - Array of…
Q: Create an implementation of your Range abstract data type called WordRange. When you are finished,…
A: In the for loop of java the iteration work on list not object of the class so that's why showing…
Q: Implement function WriteRectangle to display a (filled) rectangle on the screen, with the width and…
A: According to the information given:- We have to follow the instruction in order to get desired…
Q: Given the above parameters, implement a function that returns a string representing the plant (see…
A: Start. Use loop to print the character for 25 times. Declare the plant function to pass the…
Q: lettersOnly (s) Write the function lettersOnly (s) that takes in a string called s, and returns a…
A: Given:
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: function isUnfairHurdle(hurdles) { const tooHigh = hurdles.length >= 4; let tooClose = false;…
Q: Peacn I need help to write down the descri[tion of this prgramm coding for example, like you give…
A: from tkinter import * import math import parser import tkinter.messagebox root = Tk()…
Q: public static String pancakeScramble(String text) This nifty little problem is taken from the…
A: Code: public class Scramble { public static void main(String[] args) {…
Q: Python only Rajesh loves lucky numbers. Everyone knows that lucky numbers are positive integers…
A: The program is written in Python. Check the program screenshot for the correct indentation. Please…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: I give the code in Python (because no language is mentioned) along with output and code screenshot.…
Q: Task 2: Implement the function Searchingstrings that allow to search a sub-string in a given string…
A: The solution for the above-given question is given below:
Q: def sum_string (string: str) -> int: Given a string , return the sum of this string, as computed by…
A: ALGORITHM:- 1. Traverse the string. 2. For each even index add the number. 3. For each odd index…
Q: 1) Store the following data into a tuple, colors: red, green, 2) Store the following data into a…
A: colors=("red","green"); shapes=["rectangle","circle"]; #if there is no spacingprint("colors:…
Q: Write a function that checks whether two words are anagrams. Two words are anagrams if they contain…
A: First, we will input both the strings s1 and s2. Then we will convert both the strings into two…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: function isUnfairHurdle(hurdles) { const tooHigh = hurdles.length >= 4; let tooClose = false;…
Q: def sum_string(string: str) -> int: """ Given a string , return the sum of this string, as computed…
A: def sum_string(in_str): # function to calculate sum of string summ = 0…
Q: xiv) In JAVASCRIPT, write a function that takes input a string and prints whether the first…
A: In JAVASCRIPT, write a function that takes input a string and prints whether the first character of…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: Since the programming language is not mentioned, I have provided the code using JavaScript.
Q: QI. Write code segments in IDE (netbeans or any other), paste its screenshot. There should be no…
A: Introduction of the Program: The C++ program takes the sequence of a DNA and checks that the entered…
Q: Rewrite the following class template as a template function bool math_func(int a, double b, long c)…
A: Solution: Given, bool math_func(int a, double b, long c) { if(a*b==c) { return true} else {return…
Q: What is the data type of the parameter of the charAt method of the String class? Choose from the…
A: Below i have answered:
Q: public class CustomString { String myString; boolean isSet; public…
A: ANSWER: public class Custom String { String String; boolean isSet; public Custom String() { // TODO…
Q: Implement your own version of Python string methods The provided file string_functions.py defines…
A: The following are the functions in python, please append necessary code like function call
Q: Write a function called monkey_experiment that takes in a goal string (e.g., "methinks it is like a…
A: Outputs:
Q: What is the difference between list and tuples in Python? 2. What are the conditions of naming a…
A: The table underneath incorporates the essential contrast among list and tuple in Python. List…
Q: Solution in Java Implement parameters: a method removeWord() that takes two string sentence the…
A: Input - Array of String Output - missing letter logic - s.replace(" " + w, ""); In this problem,…
Q: 5. Add a firstname parameter of type String to myMethod, and output "Azeneth Garcia". static void…
A: Function Parameter: The function parameter includes the data type and the variable name. The data…
Q: Write a function that finds the number of occurrences of a specified character in a string using the…
A: Define function counts with parameter s and ch. Define variable occ and initialize it to 0. Use for…
Q: (6) Implement the ReplaceExclamation() function. ReplaceExclamation() has a string parameter and…
A: Functions declared: Compare() to compare the string if ! (exclamation) is prefix of the string and…
Q: in python Create a list of 20 random grades between 0 and 100. Write the code for a filtering that…
A: Answer Code in Python import random lst = random.sample(range(0, 100), 20) output =…
Q: create_equation(n, pct_per_digit): Takes one positive odd integer and one float in [0, 1[ as input.…
A: from blackout_utils import * import random random.seed(9001) OPERATIONS = ['^', 'x', '/', '+', '-']…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: I give the code in Python along with output and code screenshot
Q: public static String pancakeScramble(String text) This nifty little problem is taken from the…
A: Given: This nifty little problem is taken from the excellent Wolfram Challenges problem site where…
Q: get_words_last_1(): """ The function should take a list of words as an input parameter and return a…
A: Python code to perform the given question is mentioned below.
Q: Revorse the vewels def reverse_vowels(text): Given a text string, create and return a new string…
A:
Q: Solution in Java Implement parameters: a method removeWord() that takes two string sentence the…
A: In this problem, we need to design the code in the JAava programming language. Input - two strings…
Q: Write a program which has a class called String, appropriate member functions to get input into an…
A: Note: Since you have not provided the language to write the code so I am using Java language to…
Q: Java Without using any java functions, data structures, libraries, string builder or anything…
A: The StringTokenizer classes in Java is used to tokenize a string. When taking a substring of both…
Q: Can you please help me with this I'm stuck #include #include #include #include using namespace…
A: Only problem in your code is with functionWithPointers, how you are declaring it and then how you…
Q: Description - this is a recursive function that prints the string repeatedly. Each time it prints…
A: #include<stdio.h>#include<string.h> #define STR_MAX_SIZE 100 void preserveString(char*,…
Q: Exercise 3 (Resursive String Reversal) Create a class called StringReversal. Inside of it, create a…
A: Given:
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- PHP Write a wordFilter function Write a function wordFilter($str) that takes a string representing a sentence as a parameter. It should replace all occurrences of certain blacklisted words with asterisks of the same length and return the substituted sentence. The words “shoot” “darn” and “fudge” (case insensitive) are considered blacklisted. However, these words as part of a larger word should be left alone (e.g. overshoot is fine as it is). Use one or more regular expressions with replacements in your solutions (e.g. preg_replace).Implement the fix_capitalization() function. fix_capitalization() has a string parameter and returns an updated string, where lowercase letters at the beginning of sentences are replaced with uppercase letters. fix_capitalization() also returns the number of letters that have been capitalized. Call fix_capitalization() in the print_menu() function, and then output the edited string followed by the number of letters capitalized. Hint 1: Look up and use Python functions .islower() and .upper() to complete this task. Hint 2: Create an empty string and use string concatenation to make edits to the string. Ex: Number of letters capitalized: 2Implement the ShortenSpace() function. ShortenSpace() has a string parameter and updates the string by replacing all sequences of 2 or more spaces with a single space. ShortenSpace() DOES NOT output the string. Call ShortenSpace() in the PrintMenu() function, and then output the edited string. Ex: Edited text: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends here; our hopes and our journeys continue!
- Write a function that when given a URL as a string, parses out just the domain name and returns it as a string. Examples:domain_name("http://github.com/SaadBenn") == "github" domain_name("http://www.zombie-bites.com") == "zombie-bites"domain_name("https://www.cnet.com") == "cnet"Note: The idea is not to use any built-in libraries such as re (regular expression) or urlparse except .split() built-in function""" # Non pythonic waydef domain_name_1(url): #grab only the non http(s) part full_domain_name = url.split('//')[-1] #grab the actual one depending on the len of the list actual_domain = full_domain_name.split('.') # case when www is in the url if (len(actual_domain) > 2): return actual_domain[1] # case when www is not in the url return actual_domain[0] # pythonic one linerdef domain_name_2(url):Please answer it in Python Write a palindrome function that takes a word as an argument and returns a Boolean indicating whether the word is a palindrome. A palindrome is a word that remains the same when read from right to left instead of the usual order from left to right. Example: palindrome('here') is True but palindrome('go') is False. Write a function word_allows taking as an argument a word and a list of forbidden words, and returning True if the word is allowed, and False if the word is prohibited. Example: word_allows('fric', ['sous', 'fric', 'thune', 'ble']) is False word_allows('silver', ['sous', 'fric', 'thune', 'ble']) is trueplease code in python MCQ are a very popular form of assessment because they can be automatically graded…and the students can choose an answer at random if they don’t know.The goal of this exercise is to write a function scoreMCQ(attempt, correct), where attempt is a string that contains the answers of the student and correct is a string with the correct answers.The function should return the number of correct answers.Check first that both strings have the same length, otherwise raise an exception.If both strings are empty the score should be 0 of course.To test your code, you can copy paste the following assert statements as your main function:assert(scoreMCQ("","")==0), "First test failed"assert(scoreMCQ("TFTF","TTTT")==2), "Second test failed"assert(scoreMCQ("TTTT","TTTT")==4), "Third test failed"assert(scoreMCQ("CCCC","ABCD")==1), "Fourth test failed"print("All tests succesfull")
- The international standard letter/number mapping for telephones is: Write a function that returns a number, given an uppercase letter, as follows:def getNumber(uppercaseLetter):Write a test program that prompts the user to enter a phone number as a string. The input number may contain letters. The program translates a letter (uppercase or lowercase) to a digit and leaves all other characters intact. Here is a sample run of the program: Enter a string: 1-800 flowers1-800-3569377PHP Write a matchSSN function Write a function matchSSN($str) that takes a string representing a social security number as a parameter. The function should return true if the SSN is valid, and false if it is not. An SSN consists of 9 digits that are sometimes, but not always, separated by dashes between the 3rd and 4th digits and between the 5th and 6th digits (e.g. 123-45-6789). Use regular expressions in your solution (e.g. preg_match).IN MAGICFS LANGUAGE The Fibonacci sequence begins like this: 0,1,1,2,3,5,8,13,21,... A number in the sequence is the sum of the previous two numbers in the sequence, with first two being 0 and 1. Implement a function named 'fibonacci' that expects a working value of an integer index, and returns the Fibonacci number at that position in the sequence. The index is zero-based. For instance, if given a value of 4, the function should return 3 because the sequence is 0, 1, 1, 2, 3, ... Use subroutines if necessary. Your answer will be evaluated for partial credit. Comments are encouraged.
- Write a function MedianWithoutHL(ScoreList) that takes an unsorted list of n numbers as a parameter, discards the highest and the lowest numbers and return the median. You can assume the number of items in the list is between 0.0 and 9.9. To find the median from a list of items, you have tosort the list and find out the value of the item in the middle.Note: If the list has an odd number of items, the median is the value of the middle item. If the list has an even number of items, the median is the average of the two middle items.Sample Run #1:scoreList1 = [9.0, 9.0, 7.5, 8.0, 9.5, 6.5, 5.0, 7.0, 7.5, 8.5]print("The Original ScoreList: ", scoreList1)print(MedianWithoutHL(scoreList1))Output of Sample Run #1:The Original ScoreList: [9.0, 9.0, 7.5, 8.0, 9.5, 6.5, 5.0, 7.0, 7.5, 8.5]The List after sorting: [5.0, 6.5, 7.0, 7.5, 7.5, 8.0, 8.5, 9.0, 9.0, 9.5]Without the High & Low: [6.5, 7.0, 7.5, 7.5, 8.0, 8.5, 9.0, 9.0]7.75Course: Data Structurre and algorithms Language: Java Make a Program in java. Read the properly its easy but explained in theory. You have to solve ( make program ) the question by properly as you can error and ommisions will be accepted please. Kindly make it unque dont copy paste. <You have to solve this question as you can kindly dont excusses> Implement a global function“CompareNumbers”which is passed twoSlinkedListobjects as parametersnamed list1, and list2. The function will compare both the numbers corresponding to the lists and will return 0 if both the numbers are equal, return 1 if number corresponding to list1 is greater and will return 2 if number corresponding to list2 is greater. For this task you have to choose an appropriate data structure that will help you do this task in the most efficient manner with regard to time and space complexity.You are allowed to reverse the linked lists for this task. intCompareNumbers(SlinkedList list1, SlinkedList list2)Recursion and loops. Provide both recurrent and loop based implementation of the function count( e, L ) that returns the number of es in L, where L is a list. Also consider cases when L is an empty list. Create test cases and run driver, show how function runs in spyder (py file) or ipynb file. Submit code as a py or html or pdf files with screenshots of the runs.