6. Write a program which reads string and rewrite it in alphabetical order. For example, the word STRING should be written as GINRST.
Q: 2, What is the computational complexity of the following function? // findprimes // This function…
A: The part of the code used to initialize and print the values of array "a" takes O(n) time. but the…
Q: 2, What is the computational complexity of the following function? // findprimes // This function…
A:
Q: This is python programming Create a function based on the following information: You are given…
A: Program Approach : Define function A. Declare string s1 and s2. Split string s1 and s2 . Perform…
Q: Question Take a string input from the user and print a modified string where the characters in the…
A: ALGORITHM Step1 : take string input from the user and calculate its length using len() Step2:declare…
Q: Write a function called Divisors which takes an integer and print all its divisors on the screen.…
A: Since no language is given in the question. I am using c++ langauge See below step
Q: Question 1 Write a function that takes twɔ integers and returns the value that is greater. If the…
A: As per our guidelines we are supposed to answer only one question kindly repost other question as a…
Q: Write the python code and alternative solution for; Write a function called…
A: 1) Let input string be 'str[]' and length of string be 'n' 2) l = 0, r = n-1 3) While l is smaller…
Q: Write a python program that ask user to enter a string, pass that string as a parameter to a…
A: i have provided solution in step2.
Q: Here is a function prototype: int getTotal(int, double, string); Which of these prototypes would…
A: Method Overloading is a feature that allows a class to have more than one method having the same…
Q: Q2: Write a JavaScript function that accepts a number from a user as input and checks if the number…
A: I give the code in javascript along with output and code screenshots
Q: A triangular number is defined as m(m + 1)/2 for m = 1, 2, c , and so on. Therefore, the first few…
A: #include <iostream>using namespace std;int getTriangularNumber(int m){ return m*(m+1)/2;}int…
Q: Write a program whose input is a character and a string, and whose output indicates the number of…
A: The C++ program to count the appearance of a character present in a string by using a user-defined…
Q: Write a function that takes a string as input and PRINTS the following pattern on the screen based…
A: Here I have first of all created a function stringShift that will print the string by shifting each…
Q: write another function drawLine(int x, int y) in the above code. this function should return length…
A: GIVEN: write another function drawLine(int x, int y) in the above code. this function should return…
Q: Write a function named printN that takes an int n, a string s, and returns void. This function must…
A: The C++ program uses a function named printN to print the string to the given integer times. A…
Q: In the game of scrabble, there are white tokens called Jokers. These tokens can be used to replace…
A: Hey there, I am writing the required solution of the above stated question.Please do find the…
Q: Consider the function f(x, y), defined for x E R, y E R as follows: x + y for x > 0 and y > 0 { for…
A: def func_xy(x,y): if (x>=0 and y>=0): return x+y if (x>=0 and y<0):…
Q: Write a program to generate the next larger number by rearranging the digits of the given number.…
A: The program is written in Python. Check the program screenshot for the correct indentation. Please…
Q: Using the function from the previous problem, write a function durdle_game(target) which takes in as…
A: Please find the answer below :
Q: 9. You are a class teacher at a kindergarten school. As a task, you asked your students to write a…
A: 1) Below is program to read a string from user and capitalize the string and display It defines a…
Q: Write a program with a function that takes a string; if the length of a string is even, the function…
A: Algorithm: If the length of string is odd then (*) will be put after the string If the length of…
Q: Using functions, create a program that reads three integer values, and then determines whether they…
A: Ans : Code: #include <iostream> using namespace std;void isTriangle(int a, int b, int c){…
Q: There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time. Given N,…
A: - We have to write a program in c++ to determine the count of steps to reach nth step from start if…
Q: Write a function that counts and returns the number of vowels in a word. The function's one…
A: Given data is shown below: Write a function that counts and returns the number of vowels in a word.…
Q: Create a function that takes a list of functions and sorts them in ascending order based on how many…
A: function funcSort(arr) { return arr.sort((a, b) => { let aCalls = calls(a); let bCalls =…
Q: Write a function PrintShampooInstructions(), with int parameter numCycles, and void return type. If…
A: Completing the given C++ program so, that it can follow the given rubrics:Firstly, displaying a…
Q: in the real world, it is easy to be fooled by the description of a problem into thinking that you…
A: Python sued to answer this question
Q: lllustrating your answer using the buggy code below, explain in your own words what it means for…
A: Below find the solution In the given code there are 3 variables used those are score , message1 and…
Q: 4. Write a function int prime(int n) to test whether a number is a prime. Write a program to test…
A: Some interesting fact about prime numbers; Even only prime number. Every prime number represented…
Q: Write a python function that takes a string as an argument. Then converts this string using the…
A: We can simply use a list to mention all vowels and check whether character is in that list or not
Q: Write a function that takes two string parameters and their common length. It fills out the second…
A: We have to complete a function "toCapital" which takes two string parameters and their common…
Q: Create a function that takes two integers, num and n, and returns an integer which is divisible by n…
A: As no programming language is mentioned, it is solved using basic Python
Q: Implement a function, countVowels, which takes in a string and counts the number of vowels that are…
A: We have to count both lower and upper case characters as well
Q: In the real world, it is easy to be fooled by the description of a problem into thinking that you…
A: def hide_letter(s): # here s[1:] will return all letter of string s #except first…
Q: Write a Python program which asks the user for a series of strings as input, and stores each entered…
A: def text_get(): result = [] while True: s = input("Enter text: ") if s ==…
Q: 9. You are a class teacher at a kindergarten school. As a task, you asked your students to write a…
A: The program is written in Python. Please check step 2 for source code
Q: Write a function that checks whether an integer is an even digit or an odd digit integer using the…
A: Odd or Even: A certain variety is given conjointly the} task is to count even digits and odd digits…
Q: d) Two strings are passed to a function, return a string of the form, shortlongshort where short is…
A: Write a function in swift language that takes two strings as a parameter and returns a string of the…
Q: Please answer it in Python 1) Write a function start_by taking a letter and a word as an argument…
A:
Q: NEED HELP WITH THIS import random print(random.randint(1,6)) #prints a number between 1 and 6. #or:…
A: import random#functiondef try_your_luck(dice1, dice2): #cases given in question #sum is >…
Q: PYTHON "Write a program that asks the user to enter a small text using the keyboard. Once the text…
A: Program Output Screenshot:
Q: Write a function that displays all the numbers between two integers in n lines, that are divisible…
A: Programs: The general purpose of the program is to solve complex problems and establishing the…
Q: Create a program called capCount.py that has a function that takes in a string and prints the number…
A: code def string(s): a={"UPPER":0} for b in s: if b.isupper(): a["UPPER"]+=1…
Q: Write a function hello(firstname, lastname), which, for example, if called with hello('James,…
A: Hi. Since you have not mentioned any programming language, I will attempt this question using…
Q: Write a program in python with a function hello(name), which prints "Hello" followed by the value of…
A: CODE:- def hello(name): print("Hello " + str(name))name=str(input("enter the name :…
Q: Write a program that works with fractions. Your program should be able to add,subtract, multiply,…
A: PROGRAMMING APPROACH: Define the necessary header file using namespace. Define the function…
Q: Write a program that asks the user to input two numbers. If the first number entered is greater than…
A: C++ Programming language: C++ is an object oriented programming language that was developed as an…
Q: please code in python Write a function that receives a string as an input and returns the most…
A: When it is required to find the most frequent character in a string, an empty dictionary is created,…
Q: In Python: Write a function called is_prime that receives a single integer value between 1 and 50…
A: def is_prime(n): if(n==1): print(n,"is not prime") exit() else: s = 0 #…
6. Write a
7. Write a program to replace a particular word by another word in a given string. For example the “PYTHON” should be replaced by “C” in the text “It is good to program in PYTHON language”.
8. Write a program that will find the maximum number from 3 float type numbers. You have to use
the function getMax which will take 3 pointer variables and return the maximum number.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- please code in python Write a function that receives a string and a number (n) as parameters and returns a new string that contains only every nth letter from the given string. print(everyNth('banana', 2)) # should return aaaprint(everyNth('carrot', 3)) # should return rtprint(everyNth('pear', 1)) # should return pearCreate a function which replaces all the x's in the string in the following ways: Replace all x's with "cks" UNLESS: The word begins with "x", therefore replace it with "z". The word is just the letter "x", therefore replace it with "ecks". Examples xPronounce ("Inside the box was a xylophone") → "Inside the bocks was a zylophone" xPronounce ("The x ray is excellent") "The ecks ray is eckscellent" xPronounce ("OMG x box unboxing video x D") → "OMG ecks bocks unbocksing video ecks D"// 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 }
- Create a function that takes a string of words and returns the word with the highest score. Each letter of the word gets points according to its position in the alphabet: a = 1, b = 2, C = 3, etc. Examples wordRank ("A quick brown fox.") → "brown" wordRank ("Nancy is very pretty.") "pretty" wordRank ("Come back tomorrow, man!") → "tomorrow" wordRank ("Wednesday is hump day.") "Wednesday" Solution in JS 10Create a function which replaces all the x's in the string in the following ways: Replace all x's with "cks" UNLESS: The word begins with "x", therefore replace it with "z". The word is just the letter "x", therefore replace it with "ecks". Examples xPronounce("Inside the box was a xylophone") → "Inside the bocks was a zylophone" xPronounce ("The x ray is excellent") → "The ecks ray is eckscellent" xPronounce ("OMG x box unboxing video x D") ➡ "OMG ecks bocks unbocksing video ecks D" Solve with Java Script1. Write a function called removePunct() that takes a string and remove thepunctuations from that string (return a string without punctuation). Test yourfunction by getting some input from the user, print it, then pass it to theremovePunct() and then print the string with no punctuation.Note: You are not allowed to use the built-in function and methods of python (likeremove) This is a sample run of the program:Please enter a string: Hello,m , , world!This is the input: Hello,m , , world!This is after removing puncts: Hellom world 2. Write a function that takes a number and translate it to English. For example thetranslation of 2 is “two”, the translation of 29 is “twenty nine”, the translation of 291is “two hundred ninety one”.
- Write a function that finds the number of occurrences of a specified character in the string using the following header: int count(const string& s, char a) For example, count("Welcome", 'e') returns 2. Write a test program that reads a string and a character and displays the number of occurrences of the char- acter in the string.in javas Write a function that accepts string as its argument. The function should count the number of vowels appearing in the string and return that number. Write another function that accepts a string as its argument. This function should count the number of consonants appearing in the string and return that number. Demonstrate these two functions in a program that performs the following steps: The user is asked to enter a string. The program displays the following menu: A) Count the number of vowels in the string B) Count the number of consonants in the string C) Count both the vowels and consonants in the string D) Enter another string E) Exit the program The program performs the operation selected by the user and repeats until the user selects E to exit the program.3- Write a python program that ask user to enter a string, pass that string as a parameter to a function to check whether the string is a pangram or not. Pangrams are words or sentences containing every letter of the alphabet at least once.
- Write a program to enter two strings from the user using function cin.getline and then appends string two with string one separated by a blank space. Sample Input: C++ is a good programming Language. Arrays are very integral part of this language. Sample Output: C++ is a good programming Language. Arrays are very integral part of this language.Write a function that accepts a C-string as an argument and returns the number of words contained in the string. For instance, if the string argument is “Four score and seven years ago” the function should return the number 6. Demonstrate the function in a program that asks the user to input a string and then passes it to the function. The number of words in the string should be displayed on the screen.Given a string on one line and an integer number on a second line, add a copy of the last number of characters of the string to the string's end. Then, output the result. Ex: If the input is: Fuzzy bear 4 the output is: Fuzzy bearbear Note: Using a pre-defined string function, the solution can be just one line of code. #include <iostream>#include <string>using namespace std; int main() { string strVar; int substrLen; getline(cin, strVar); cin >> substrLen; /* Your code goes here */ cout << strVar << endl; return 0;}