Python code The function takes two inputs: a number and a list, and returns a list of indexes where the number can be included in the list, as well as a -1 if the number cannot be found in the list.
Q: Q: Write a program in python that asks the user to enter a word and determines whether the word is a…
A: EXPLANATION - Create a python program . Take a word as an input from the user as an input . For…
Q: Computer Science QuestionIn input you are provided with two words of the same length. Each word…
A: I have answered this question in step 2.
Q: Computer Science a: Write a python program to sort the sentence provided by the user in Alphabetical…
A: Note : As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: Graph plotting write a code (can be in c ++, python, c # ...) that graphically represents the…
A: Given Function: f(w,t)=Eo Eo cos (wt + δ) 1)Eo=1 , w=1, δ=π for t=0 to t=4π 2) Eo=1 , w=1,…
Q: The sample input will have to be in Text File (.TXT) 2. By using the first function, this program…
A: Algorithm: Start Read file name Define a method readFileValues() which takes filename as argument…
Q: 1. Create a Salary Computation using python programming 2. Create 3 Modules 3. The first module…
A: As per the given question, the required program is implemented in Python programming language.…
Q: Design of a calculator program using pseudocode and a Python program that uses a list and functions…
A: # Program make a simple calculator # This function adds two numbersdef add(x, y): return x + y #…
Q: Write a function that receives a string containing a 16-bit binary integer. The function must return…
A: if size>16: print("String given is more that 16-bit")else: for i in…
Q: Design and implement a python program that allows the user to play the game Rock Paper Scissors…
A: import random # function that return random gesture def get_random(gestures): return…
Q: Good Programming practices help in improving programs readability and understandability both for a…
A: The following are the changes done in program: Ask the user to enter the number. change the…
Q: NOTE: (what your answer will contain) 1. Use C PROGRAMMING LANGUAGE ONLY 2 Use RECURSION type of…
A: Given: To write a C program to find quotient of two numbers
Q: C++ to Python. How can I rewrite this code, using Python List Comprehension?
A: Given: C++ to Python rewrite this code, using Python List Comprehension.
Q: practice Python Programming Language, write 5-programming codes that solve different oblems. For…
A: Note: In the Bartley platform not allowed to submit or upload any kind of PDF document. On this…
Q: Produce a Python code that takes the following two lists as input Input: A= [“item1”, “item2”,…
A: Explanation: List A has first set of values. List B has second set of values. During print pick the…
Q: Write and test a function that removes the leading and trailing spaces from a string.
A: Removing leading and trailing spaces from a string using c
Q: programing python or c++ the range of values is from 0 to 5 Let Q(x, y) denote “x + y = 5” The…
A: Given: Let Q(x, y) denote “x + y = 5” The domain of x and y is from range 0 to 5 . Implement the…
Q: ython program Use functions
A: I have written code below:
Q: Ruby I/O Write a Ruby program to take input a string from the user and print it back to the…
A: #Ruby program to take input a string from the user and print it back to the output #ask user to…
Q: Python Language Problem 1. Write a program that asks a user for 3 numbers and their name.…
A: a = int(input("Enter a value : ")) # value 1 b = int(input("Enter a value : ")) # value…
Q: NOTE: (what your answer will contain) 1. Use C PROGRAMMING LANGUAGE ONLY 2. Use RECURSION type of…
A: Here I have defined a recursive function named division(). In this function, I have used a condition…
Q: Write a program that asks the user to input a positive integer. The program should output the…
A: Requirement- Write a program that asks the user to input a positive integer. The program should…
Q: 1. Use C PROGRAMMING LANGUAGE ONLY 2. Use RECURSION type of program 3. Copy and paste your code(no…
A: #include <stdio.h>int quotient(int a, int b){ return a / b;} int main(){ int a, b, quo;…
Q: Write the syntax of a for loop (index i) from 0 to n that calculates the derivatives of a function f…
A: the syntax of a for loop (index i) from 0 to n that calculates the derivatives of a function f and…
Q: Course Level Programming Assignment - Programming a Calculator using Python In this assignment you…
A: The above task in python involves the use of basic control flow statements like switcher and if-else…
Q: Python Program How can I run a program that functions like this: The user will input a word and…
A: logic:- read a word from user. iterate for each letter in word check if it is capital letter…
Q: Python program. Instructions are given within the quotations for each function. 1) def…
A: Objective: This program asks to enter a key that must be of length 26 consisting of distinct…
Q: äs The line #include is very frequent in C++ programs because the entities of the source code are…
A: The correct option will be True. Explanation:- We use #include<iostream> very frequently in…
Q: Code Example 4-1 def get_username(first, last): s = first + "." + last return s.lower()…
A: Ans: Code Example 4-1 def get_username(first, last): s = first + "." + last return s.lower()…
Q: problem. A character string that represents the number n, a number b1 that represents the base on…
A: It is defined as a powerful general-purpose programming language. It is used in web development,…
Q: (python) Write a function that will return the first word in a sentence. Call the function…
A: Python Program:- a_str = input()first_word = a_str.split()[0] print(first_word)
Q: Use pseudocode to design a swap module that accepts two arguments of the Real data type and swaps…
A: Pseudocode for swap(X,Y) Declare temp as Real temp = X X = Y Y = temp [END OF PSEUDOCODE]
Q: Graph plotting write a code (can be in c ++, python, c # ...) that graphically represents the…
A: Python program to plot the given function f(w, t) = Eo cos (wt + δ) for the given two scenarios,…
Q: Write assembly language codes that will display the output given below. Clear the entire screen and…
A: Below I have provided the assembly language code:
Q: Using box and pointer notation, draw a picture of the nodes created by the first loop in the tester…
A: this question is about creation of the node using box and pointer notation.
Q: Python, create a function that takes a string S as a parameter. This function should return a list…
A: Both Code are Correct but just different Different style or use to make it Code : # Python program…
Q: Type Code On Program Quartus represent function
A: This is very simple. Follow these steps and write the code as mentioned below: Open a new Project…
Q: Good Programming practices help in improving programs readability and understandability both for a…
A: Good Practices include: Declare every variable in one place Use Comments The program should be…
Q: Python supports the following file processing modes: read-only, write-only, and read-write.
A: A file is a container on a computer that stores data, information or commands used with a computer…
Q: Good Programming practices help in improving programs readability and understandability both for a…
A: A good programming practice means the code is readable by the user and the programmer who use the…
Q: Create a program, that has a function that takes a number and prints the number of digits in the…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: Graph plotting write a code (can be in c ++, python, c # ...) that graphically represents the…
A: Given: As per our policy, "Since you have asked multiple questions, we will solve the first question…
Q: Define a function in python which converts the temperature from Fahrenheit to Celsius.
A: Below is the required python program: - Approach: - Define the function ConvertTemp that converts…
Q: Construct a single Python expression which evaluates to the following values, and incorporates the…
A: #list indexingmy_list = ['H', 'e', '42',' ', 'W', 'o','r','l','d','!']print(my_list[2]) #keys()dict…
Q: You are given a list of students’ names and their test scores. Design an algorithm that does the…
A: Note: Since you have posted a question with multiple sub-parts, we will solve the first three…
Q: 1. Use C PROGRAMMING LANGUAGE ONLY 2. Use RECURSION type of program 3. Copy and paste your code(no…
A: Given:-> we have To write a C program that will find the quotient of two numbers by using…
Q: Create a program using c++ compiler that will accept input values while the input is not equal to…
A: #include<iostream> using namespace std; int main() { int values,sum=0,i=0,a[100]; float…
Q: Create a program using c++ compiler with 3 versions of source code using for loop, while loop, and…
A: Given Program: Program to do 3 versions of source code using for loop, while loop, and do while loop…
Q: Write in PHP a program to display the function graph y = sin (x), where x = 0… 10, with step 0.1..
A: <?php echo (sin(3)); ?>
Q: Python Function In your own words, answer the following questions
A: Function:- It is a block of statements that performs a particular task. Advantages:- function…
Q: In Python use import sys Create a program that has a function that takes in an argument and prints…
A: Program: Programs are used to interact with the systems and perform certain tasks based on the…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
- (List maintenance) a. Write a complete C++ program that can be used to update an ordered list of numbers. Use the list of numbers shown in Figure 7.13 to test that your program is working correctly. b. Test the program you wrote for Exercise 4a, using a new part number of 86 with the list of numbers shown in Figure 7.13. This test should place this new code at the beginning of the existing list. c. Test the program you wrote for Exercise 4a, using a part number of 200 with the list of numbers shown in Figure 7.13. This test should place this new part number at the end of the existing listMultiples of ten in a list (python) Write a program that reads a list of integers, and outputs whether the list contains all multiples of 10, no multiples of 10, or mixed values. Define a function named is_list_mult10 that takes a list as a parameter, and returns a boolean that represents whether the list contains all multiples of ten. Define a function named is_list_no_mult10 that takes a list as a parameter and returns a boolean that represents whether the list contains no multiples of ten. Then, write a main program that takes an integer, representing the size of the list, followed by the list values. The first integer is not in the list. Ex: If the input is: 5 20 40 60 80 100 the output is: all multiples of 10 Ex: If the input is: 5 11 -32 53 -74 95 the output is: no multiples of 10 Ex: If the input is: 5 10 25 30 40 55 the output is: mixed values The program must define and call the following two functions. is_list_mult10() returns true if all integers in the list are multiples…A list cannot be passed as an argument to a function. True False
- reads an external character file and passes it to a list variable. Returns a list containing the words in the file as the return value of the function python functions _read_file_(): text inside:vejOnVacnesdsavWurndasorsdadsadaGhahidBejAcRenfacimJsadsadaiOnsOcsGebposAfAtOcFipswoukVuvaygdyswotWrite a function to sort the list. [You are not allowed to create any other list]. Use Python Language and Linked Lists. Sample Input Sample Output 1 -> 2 -> 5 -> 3-> 8 1 -> 2 -> 3 -> 5 -> 8In Python with comments please 4. Largest List ItemDesign a function that accepts a list as an argument and returns the largest value in the list. The function should use recursion to find the largest item.
- Using c++ Contact list: Binary Search A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use binary search. Modify the algorithm to output the count of how many comparisons using == with the contactName were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3 Frank 867-5309 Joe…TODO 5 List and indexing practice. Create a list containing all even numbers up to and including 100. Store the list in a variable called even_list. Try using Pythons range() function (docs)and then casting it as a list using list(). Check the length of the even_list. Store the output into the even_list_length variable. Use list indexing to return the last 5 elements of the even_list. Store the output into last_five_even_elements. Use list indexing to return the second to last element of the even_list. Store the output into second_to_last_even_element. Use list indexing to return the first 10 elements of the even_list. Store the output into first_ten_even_elements. # TODO 5.1 even_list = print(f"even_list output: {even_list}") todo_check([ (even_list == [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100], 'even_list does not match the desired output! Make sure you have even numbers…IN SCALA COMPLETE THE FUNCTIONS (prod, overlap and similarity) //(1) Complete the clean function below. It should find // all words in a string using the regular expression // \w+ and the library function // // some_regex.findAllIn(some_string) // // The words should be Returned as a list of strings. def clean(s: String) : List[String] = { valreg = """\w+""".r reg.findAllIn(s).toList } //clean("list of strings") //(2) The function occurrences calculates the number of times // strings occur in a list of strings. These occurrences should // be calculated as a Map from strings to integers. def occurrences(xs: List[String]): Map[String, Int] = { valcleaned = xs.distinct cleaned.map(x => (x , xs.count(_==x))).toMap } //occurrences(List("a","a","b")) //(3) This functions calculates the dot-product of two documents // (list of strings). For this it calculates the occurrence // maps from (2) and then multiplies the corresponding occurrences. // If a string does not occur in a document,…
- Perl I CpSc 390 Usin Perl Programm: A list of names (names) is given : “Jo Peter Ann Fred Linda Joe”. Please do the following: print the names for the order number of the names find the name (CTRL-Z to exit from the input) a second list with other group of names is also given: ”Mary, George, Nick”. An extension of the first list (names) so that to include the new names is needed. Hint: try to keep space among the names make sorting reverse take the size of the list take the new list (from d) : peter linda joe jo fred an Nick Mary George and delete all the other names except : Joe, Peter, Mary, George. (in any order) . Give the name for the list as: names1Write a function to reverse the list. [You are not allowed to create any other list.] Use Python Language and Liked List Manipulation. Sample Input Sample Output 1 -> 2 -> 5 -> 3-> 8 8 -> 3 -> 5 -> 2 -> 1Contact list: Binary Search A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Define and call the following function. The return value of FindContact is the index of the contact with the provided contact name. If the name is not found, the function should return -1 This function should use binary search. Modify the algorithm to output the count of how many comparisons using == with the contactName were performed during the search, before it returns the index (or -1). int FindContact(ContactInfo contacts[], int size, string contactName) Ex: If the input is: 3 Frank 867-5309 Joe 123-5432 Linda…