Write a function that takes a string as an argument, such as "Burkay" and then returns the following string pattern: "B1U2R3K4A5Y". More examples follow: strPattern("A") ==> "A" strPattern("b") ==> "B" strPattern("ab") ==> "A1B" strPattern("AbC") ==> "A1B2C"
Q: Write a function replace_head_tail that takes a string str1 and replaces the first X and last Y…
A: Please find the answer below :
Q: Write a function isPar to test if a string is a palindrome. Multiple functions. isPar "radar" → true…
A: The following function is written in Java to test the string is palindrome or not:
Q: We can assign a value to each character in a word based on their position in the alphabet (a = 1, b…
A: Code function balanced(word) { let alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',…
Q: Write a function called count_vowels that accepts a string argument that represents a word and…
A: Code: #required function def count_vowels(s): #list to store vowels vowels = ["a", "e", "i",…
Q: Write a function named alternateCapital, which takes a string as an argument and returns a string…
A: Step 1 : create function name alternateCapital Step 2 : take argument string and make loop of…
Q: Write the following function to check whether a string is a palindrome assuming letters are…
A: # function which return reverse of a string def isPalindrome(s): return s == s[::-1] # Driver codes…
Q: Write a program that uses the function isPalindrome. Modify the function isPalindrome so that when…
A: Below program outputs if the input string is a palindrome or not. The function isPalndrome takes the…
Q: String: abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba Make a program that: reads a…
A: C++ program to solve the given problem is below. **Note: As programing language is not mentioned…
Q: 1. Word Garbler Write a python program that inputs a string from the user, then outputs a garbled…
A: Solution:- Program: import randomdef wordGrabler(s):return ''.join(random.sample(s,len(s))) if…
Q: Write a program that prompts the user to input a string. The program then uses the function substr…
A: Here is the solution which is mentioned below:
Q: An integer is passed as a string to a function, the function returns whether the integer is a valid…
A: An integer is passed as a string to a function, the function returns whether the integer is a valid…
Q: Prompt the user to enter a string s and an integer i in the range 0 to l where l is the length of…
A: Given: Prompt the user to enter a string s and an integer i in the range 0 to l where l is the…
Q: 1. Word Garbler Write a python program that inputs a string from the user, then outputs a garbled…
A: Note : as per our guidelines we are supposed to answer?️ only one question. Kindly repost other…
Q: Write a program that prompts the user to enter a string. The program then uses the function substr…
A: #include <iostream>#include <string.h>#include <conio.h>#include…
Q: This is a computer programming question The code should be in C++ language Write a program that…
A: Iterate over string If character at index i is vowel skip it and if not vowel add to another string…
Q: Write a main function that does the following: 1. Store the word Queensborough into a variable. 2.…
A: Code: #include <iostream>#include <string>using namespace std; int main() { string…
Q: Write a function named alternateCapital, which takes a string as an argument and returns a string…
A: The upper() function is the C++ string header file function that takes a character as input and…
Q: write the following as a function that takes in a string and returns a string. for (int i=0; i…
A: Code: #include <iostream>using namespace std;#include<cstring>//required function that…
Q: Write a function called show_palindrome that takes a number as an argument and then returns a…
A: To solve two method one should aware of list and string data type And for loop , converting int to…
Q: write a program that prompts the user to input a string. then the program uses the function substr…
A: Lets see the solution.
Q: longest.py -> using sys.argv ● Create a program, longest.py, that has a function that takes one…
A: Start define a function longest that takes string as an argument find longest word print input…
Q: The isupper function turns all uppercase letters in a string. Is it true or false
A: isupper is a function available in C programming
Q: Write a main function that does the following: 1. Store the words borough into a variable. 2. Use…
A: String concatenation is done using append function. string& string::append (const string&…
Q: Create a function which replaces all the x's in the string in the following ways: 1. Replace all x's…
A: 1. create the method with 1 argument 2. create the array and split the sentence with ' ' 3. map the…
Q: Write a function in R studio called show_palindrome that takes a number as an argument and then…
A: An number that reads the same forward and backward is called palindrome numbers.…
Q: Write a C program that gets a string from the user and counts total number of digits in that string.…
A:
Q: Write a function called smallestLetter that takes in a string argument and returns a char. The char…
A: Program: //include the required header files #include <iostream> using namespace std; //…
Q: Create a function that takes a string txt and returns the string in monkeys language. You have to…
A: function monkeyTalk(txt){ let result = [] let arr = txt.split(" ") for (let i = 0; i <…
Q: Wite a program diat prompts the user to input a string. The program then uses the function subetr…
A: According to our guidelines, we are allowed to solve only the first question. Please post the other…
Q: Prompt the user for a string that contains two strings separated by a comma, • Examples of strings…
A: Function checkComma() checks if string contains comma or not. If string contains comma it will send…
Q: A Pal rdrome is a string that is identical to its own reversal. For example 'kayak’ and 'straw…
A: def isPalindrome(s): for i in range(0, int(len(s) / 2)): if s[i] != s[len(s) - i - 1]:…
Q: In Python, program a function called "capitalizePhrases", with the following heading: #…
A: Algorithm: Start Read a string upperText Implement a function capitalizePhrases() which takes a…
Q: in c++: Write a program that prompts the user to input a string. The program then uses the function…
A: Program Approach: To keep our string without vowels, initialize a new string, say t. Initialize the…
Q: Write a function that takes in a string input from the user. The function should then print the…
A: C program: C is a general purpose programming language. It was developed by Dennis Ritchie at AT…
Q: Write a function that accepts a C-string as an argument and returns the number of words contained in…
A: program: #include<iostream>#include<string.h>using namespace std;// function to count…
Q: Write the longest function using the following function header to return the longest string among…
A: Declare the required libraries. Declare the function to check the longest string among two strings…
Q: Write a function that take in a string as the parameter and return the number of character in that…
A: Here no language is mentioned so I have given C program for this question.
Q: A string is passed as argument to a function named hS, the function also returns a string which is…
A: A string is passed as argument to a function named hS, the function also returns a string which is…
Q: Write a function capitilaze_words() that gets a string as a parameter, capitalize the first and last…
A: Step 1:- Start. Step 2:- Take user input. Step 3:- Slice string from 0 to 1 and convert its case to…
Q: String: abcdefghijklmnopqrstuvwxyzyxwvutsr qponmlkjihgfedcba Make a program that: reads a…
A: Python program to solve the given problem is below.
Q: Write a function named prntstr that receives a string as parameter from the caller The function will…
A: Algorithm: We will use two loops. for(int i=0;i<strlen(str);i++) for(int j =…
Q: Write a program that prompts the user to input a string. The program then uses the function substr…
A: 1. Prompt the user to input a string. 2. Use 'substr' function to remove all the vowels from the…
Q: Create a function which replaces all the x's in the string in the following ways: Replace all x's…
A: 1. Create Function with a String argument. 2. Created the new variable arr 3. Split sentence by…
Q: Write a function capitilaze_words() that gets a string as a parameter, capitalize the first and last…
A: """Program to write function capitilaze_words and test that function""" #function capitilaze_words…
Q: Write a function that accepts a string as an argument and display the string backwards
A: Program code: #define the function to reverse a stringdef my_function(x): #return the reverse…
Q: Write a function that converts a floating-point number to a string. Provide a parameter variable for…
A: The idea is to separate integral and fractional parts and convert them to strings separately.…
Q: Problem Statement Implement a function which takes two arguments: the first is a string and the…
A: def construct(string, c): newString = "" count = 0 for character in string: if…
Q: Write a function that takes in a string input from the user. The function should then print the…
A: The function is written in Python programming language. Algorithm: Start Define the function…
Q: Complete the function show_upper. This function takes one parameter - a string (s). It should return…
A: Asked Question: Complete the function show_upper. This function takes one parameter - a string (s).…
Q: PYTHON) Write a program with a function that takes a string; if the length of a string is even, the…
A: Code is given below #defining addAsterisk function, the def keyword is used to define a function,…
Write a function that takes a string as an argument, such as "Burkay" and then
returns the following string pattern: "B1U2R3K4A5Y". More examples follow:
strPattern("A") ==> "A"
strPattern("b") ==> "B"
strPattern("ab") ==> "A1B"
strPattern("AbC") ==> "A1B2C"
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- // Write a function that takes 1 argument, a string. // It returns true if the string is a palindrome (the same forwards and backwards). // It returns false if the string is not a palindrome. const isPalindrome = (string) => { // your code here... // Examples isPalindrome("cat") // returns false //isPalindrome("level") // returns true }Write a program that prompts the user to enter a string. The program then uses the function substr to remove all the vowels from the string. For example, if str = "There", then after removing all the vowels, str = "Thr". After removing all the vowels, output the string. Your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel. this is what is have: #include <iostream>#include <string>using namespace std; string substr(string word);bool vowel(char ch); int main(){string word;string newWord;cout << "Enter a word: ";cin >> word; newWord = substr(word);cout << "Your new word is: " << newWord << endl; return 0;}string substr(string word){ }Write a program called p3.py. Write a function called validate() that takes a string as input, validates that it is a single letter, and returns the letter in lowercase.Example:validate(“A”) returns avalidate(“abc”) returns invalid
- Write a function sum(x,y) that returns a string indicating what the sum of x and y is. For example, when x=3 and y=17 your function should return the string 'The sum of 3 and 17 is 20.'(PYTHON) Write a program with a function that takes a string; if the length of a string is even, the functionshould add an asterisk at the beginning of a string; else, the function should add asterisks at the end ofa string. The function, then, capitalizes all letters and returns the new string The program should let the user enter a string and pass it to the function.python Write a function named first_medium_last that accepts a single string as its parameter representing a person's first, middle and last name. The function should return the person's first name, followed by their middle initial, followed by their last name. For example, the call first_medium_last("Bartholomew JoJo Simpson") should return "Bartholomew J. Simpson". You may assume that the argument consists of exactly three words separated by single spaces. Note that there should be a period (dot) after the middle initial.
- Write a function reverseString that takes in a string as input and returns the string with its characters reversed. Example: Input: "Hello, World!" Output: "!dlroW ,olleH" Write a function reverseString that takes a string as input and returns the reversed string. Note: You are not allowed to use any built-in reverse functions or methods. Constraints: The input string consists of printable ASCII characters. Hint: You can swap the characters from both ends of the string until you reach the middle.Write a function that accepts a string as an argument and returns true if the argument ends with the substring '.com'. Otherwise, the function should return falseWrite a program that uses the function isPalindrome. Modify the function isPalindrome so that when determining whether a string is a palindrome, cases are ignored, that is, uppercase and lowercase letters are considered the same. Using C++ and code ".+*isPalindrome\(\"Madam\"\).+*"
- Write a function called string_reverse() that accepts a string from the user as a parameter. The function should create and return a new string that contains all the same letters of the parameter string, but in reverse order. For example, string_reverse("Hello World") would return "dlrolW olleH". Write a main() function to demonstrate how it works. In pythonWrite a function that takes a reference to a string as an argument and which converts the string to all uppercase.Write a function secondIndexOf, taking two strings and determining the second occurrence of the second string in the first string. If the search string does not occur twice, -1 should be returned. Example: secondIndexOf('White Rabbit', 'it') should return 10.