Programming Problems doubleVowel Write a function doublevowel that accepts a word as an argument and returns True if the word contains two adjacent vowels and False otherwise. Sample usage: >>> doublevowel ('apple') False >>> doubleVowel ('pear') True >>> doubleVowel ('pear') True >>> doublevowe]('DURIAN') True >>> doublevowel ('baNaNa') False >>> doubleVowel ('baNaNa')== False True
Q: Passwords, again Learning objectives In this lab, you will practice: writing a function to match…
A: #create function newPassworddef newPassword(petName, favouriteNumber): #return return…
Q: // Example countLetters("hello") // returns 1 // Exercise 2 //…
A: Excercise1 Letter count function in Javascript…
Q: Write a function named strictly-increasing lst in Scheme that takes a list of integers and…
A: Algorithm: Step1: strictly_increasing takes list as parameter.Step2: Function has condition that…
Q: Function Call Diagram Write a function call diagram showing this program. #include…
A: Explanation: The given program contains three functions, “main()”, “average()”, “sum()” . Here,…
Q: Write a program that inputs, processes, and outputs a set of student records organized as a vector…
A: First, we will create a structure named StudentRec. Then we will add students records accordingly…
Q: longest.py -> using sys.argv ● Create a program, longest.py, that has a function that takes one…
A: Need to provide python code that has a function that takes one string argument and prints a sentence…
Q: Instructions: The purpose of this lab is to intoduce pthreading, which will be the modeling used for…
A: in the above question we explain you which modelling to be used. About Parallalism programming…
Q: Please help, #include // malloc/free and NULL // Include the declarations of our string…
A: Here i explain what function do: ==============================================================…
Q: Write a function template that accepts an argument and returns its absolute value. The absolute…
A: GIVEN The absolute value of a number is its value with no sign. For example, the absolute value of…
Q: In this lab, you use what you have learned about searching an array to find an exact match to…
A: #include <iostream>#include <string>using namespace std; int main() { string…
Q: clean Write a function clean that when is given a string and returns the string with the leading and…
A: def clean(s): # Initialize pointers for start and end of non-space characters start = 0 end…
Q: > amount; 4 cout > amount; 11 cout << endl; 12 int numBills2 = (int) (amount / 20.0); 13 if…
A: 1. Define a function calculateBills that takes an amount as input:1.1. Calculate the integer part of…
Q: Homework 10-1 Programming Challenge: 2 - Backwards String Write a function that accepts a string…
A: Solution: Given, Write a function that accepts a string and returns a string in which the…
Q: Objectives After this lab assignment, students should be able to: • Write functions according to…
A: NOTE Below is the answer for the given question. Hope you understand it well. If you have any…
Q: // MichiganCities.cpp - This program prints a message for invalid cities in Michigan. // Input:…
A: You need to check with each and every element in the array of strings and if it equals the input…
Q: ters are the value passed to a function when the function is called and Argument are the variable…
A: Introduction: In a function call, the parameters are the function's arguments. JavaScript arguments…
Q: Nested function classwork 2 Write 'taxIncome', a user-defined function that calculates income tax. y…
A: The below-given program will: Read input from the user. Pass the value to the function and…
Q: 1. Trace the following program and fill in the values of the involved variables in the for loop of…
A: GIVEN:
Q: 7. Inventory Class Design an Inventory class that can hold information for an item in a retail…
A: The Inventory Management System in C++ aims to implement a simple class called Inventory to store…
Q: Write a function called translate_to_italian () that takes a string as a parameter (a colour).…
A: #you didn't specified the language. So i wrote in Python language. def translate_to_italian(colour):…
Q: What is a stub? Group of answer choices A stub is an inline function with a single line that simply…
A: A stub is a small program routine that substitutes for a longer program, possibly to be loaded…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- C++ complete magic Square #include <iostream> using namespace std; /*int f( int x, int y, int* p, int* q ){if ( y == 0 ){p = 0, q = 0;return 404; // status: Error 404}*p = x * y; // product*q = x / y; // quotient return 200; // status: OK 200} int main(){int p, q;int status = f(10, 2, &p, &q);if ( status == 404 ){cout << "[ERR] / by zero!" << endl;return 0;}cout << p << endl;cout << q << endl; return 0;}*/ /*struct F_Return{int p;int q;int status;}; F_Return f( int x, int y ){F_Return r;if ( y == 0 ){r.p = 0, r.q = 0;r.status = 404;return r;}r.p = x * y;r.q = x / y;r.status = 200;return r;} int main(){F_Return r = f(10, 0);if ( r.status == 404 ){cout << "[ERR] / by zero" << endl;return 0;}cout << r.p << endl;cout << r.q << endl;return 0;}*/ int sumByRow(int *m, int nrow, int ncol, int row){ int total = 0;for ( int j = 0; j < ncol; j++ ){total += m[row * ncol + j]; //m[row][j];}return total; } /*…/* Programming concept: structures Program should: be a C program, define a structure to store the year, month, day, and high temperature. write a function get_data that has a parameter that is a pointer to a struct and reads from the user into the struct pointed to by the parameter. write a function print_data that takes the struct pointer as a parameter and prints the data. in main, declare a struct, call the get_data function, call the print_data function. */ #include <stdio.h> int main(int argc, char *argv[]) { return 0;}Problem DNA: Subsequence markingA common task in dealing with DNA sequences is searching for particular substrings within longer DNA sequences. Write a function mark_dna that takes as parameters a DNA sequence to search, and a shorter target sequence to find within the longer sequence. Have this function return a new altered sequence that is the original sequence with all non-overlapping occurrences of the target surrounded with the characters >> and <<. Hints: ● String slicing is useful for looking at multiple characters at once. ● Remember that you cannot modify the original string directly, you’ll need to build a copy. Start with an empty string and concatenate onto it as you loop. Constraints: ● Don't use the built-in replace string method. All other string methods are permitted. >>> mark_dna('atgcgctagcatg', 'gcg') 'at>>gcg<<ctagcatg' >>> mark_dna('atgcgctagcatg', 'gc')…
- For each function, describe what it actually does when called with a string argument. If it does not correctly check for lowercase letters, give an example argument that produces incorrect results, and describe why the result is incorrect. # 1 def any_lowercase1(s): for c in s: if c.islower(): return True else: return False # 2 def any_lowercase2(s): for c in s: if 'c'.islower(): return 'True' else: return 'False' # 3 def any_lowercase3(s): for c in s: flag = c.islower() return flag # 4 def any_lowercase4(s): flag = False for c in s: flag = flag or c.islower() return flag # 5 def any_lowercase5(s): for c in s: if not c.islower(): return False return True The code and its output must be explained technically whenever asked. The explanation can be provided before or after the code, or in the form of code comments within…Nested function classwork 2 Write 'taxIncome', a user-defined function that calculates income tax. y = taxincome (income) defines the principal function. The main function calculates adjusted income as income - 6000. Then y = compute Tax is called. For y = 0.28*Adjusted Income, this function uses 'Adjusted Income'. 'Adjusted Income' was defined in the main function. Use $80,000 income.Probelm part 1: Define a function called common_divisors that takes two positive integers m and n as its arguments and returns the list of all common divisors (including 1) of the two integers, unless 1 is the only common divisor. If 1 is the only common divisor, the function should print a statement indicating the two numbers are relatively prime. Otherwise, the function prints the number of common divisors and the list of common divisors. Complete each to do with comments to expalin your process. Problem part 2: complete the following todo's and make comments to explain each step # TODO: Define the function 'common_divisors' with two arguments 'm' and 'n'. # TODO: Start with an empty list and append common divisors to the list. # TODO: Create a conditional statement to print the appropriate statement as indicated above. Problem part 3: Call the function common_divisors by passing 5 and 38. Your output should look like this: 5 and 38 are relatively prime. # TODO: Call…
- Language only c++Python without Def function Problem Statement Define and implement a function time_delta that takes two string parameters (time1 and time2) and returns the difference between them (as a string). You may assume that the second time will always be after the first time, both times will always be on the same date, and military time will be used (no a.m. or p.m.). Examples time_delta(04:15:36, 16:35:27) ➞ (12:19:51) time_delta(02:06:05, 06:09:10) ➞ (04:03:05) Sample Input 1 "04:15:36" "16:35:27" Sample Output 1 "12:19:51"Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 3, print "Too small". If greater than 10, print "Too large". Otherwise, compute and print 6* bagOunces followed by seconds". End with a newline. Example output for ounces = 7: 42 seconds 1 #include NM & in 107 2 3 void PrintPopcornTime (int bagOunces) { 4 requiriturgy 5 /* Your solution goes here */ 6 7} 8 9 int main(void) { 10 int userOunces; 11 12 scanf("%d", &userOunces); 13 14 15 16} PrintPopcornTime (userOunces); return 0;
- Programming Skills: Complete the function egg_category which returns a str describing an egg's category given its int weight in grams. Here is a table specifying the weight ranges if an egg's weight is on the boundary between two category ranges, it is assigned the smaller category. Category Small Meduim Weight no more than 50 grams 50-57 grams Category Large Jumbo Weight 57-64 grams more than 64 grams def egg_category (weight): %# Return a str describing the category of an egg of the specified int weight.rografmiming CSC 101 Introduction VB Bau Section21436.02. Sntinn 2022 ta46581 OPRIV NEXTO Workbench Exercise 40443- deadne 04020022 1150 PM WORK AREA toThePowerOf is a function thet accepts two int parameters and returns the value of the first parameter raised to the power of the second. An int variable cubeside has aiready been deciared and initialized. Another int vaciable, cubevolume, has already been declared. Write a statement that calls toThePowerof to compute the value of cubeside raised to the power of 3, and store this value in cubevolume. SUBMIT 1 of 1: Sat Apr 02 2022 23:03:03 GMT-0400 (Eastern Dayilght Time) Type your selution here.