Write a Python function which takes an integer as parameter. The integer is either equal to 1 or is a positive 5-digit integer. If integer is equal to 1: the function should ask the user to key in a positive integer . The function should return True if the positive integer is divisible by exactly 3 distinct positive integers, between 1 and integer inclusive. Otherwise, the function should return False. You are not allowed to convert integer to a string, and no lists. You can use integer division and modulo.
Q: In python, get_tokens_from_equation(line): Takes one string as input that contains any combination…
A: Answer for given question -
Q: Write a Python function called name_processor that takes a list of students' full names and returns…
A: According to the Question below the Solution: Output:
Q: Python please: Write a program that takes input of a list of text, numbers, etc., and outputs…
A: Python Code: while True: a=input() if(a=='d' or a=='done' or a=='Done'): break: else:…
Q: Topic: Big-O Notation and Algorithm
A: solution : The required Python code is as follows: def user_input(n):for i in…
Q: for my python class, I need to write a program that has a list that stores repeated heart-rate…
A: Average of heart rate in python . The heart rates are stored in a list
Q: Write a program that accepts the total number of input values that the user will provide and…
A: Given :- Write a program that accepts the total number of input values that the user will provide…
Q: Write a Python program that prompts the user to enter grades to a list, alist (which is initially…
A: alist=[]print("Enter grades to calculate their average,-1 to stop entry: ",end='')l=0while…
Q: Write a Python program that will take a string of alphabets as the input from the user. Then, your…
A: string =input()#inputting the valued={}#dictionary declaration for i in string:#taking each…
Q: Please answer it in Python Write a palindrome function that takes a word as an argument and returns…
A: #Palindrome function that takes a word as an argument and returns a#boolean indicating whether the…
Q: Input1: A list containing 10 numbers Input2: A number,N Find a set of four numbers in the list…
A: Python is a high-level interpreted programming language, that's also used to build web browser…
Q: Write a Python program that will take a string of alphabets as the input from the user. Then, your…
A: Given: Write a Python program that will take a string of alphabets as the input from the user.…
Q: Write a Python program that reads 5 numbers into a list and prints the second largest number and its…
A: A list is a mutable data structure in Python. A mutable object is an object whose value can change…
Q: Develop a program that gets a list of student grades and find: grade average, max grade, and min…
A: Input : Input grades of students Output : Average grade Maximum grade Minimum grade
Q: Can you answer with the Python software language Write a function that takes a list of tuples as…
A: In step 2, you will the python code. In step 3, you can see the sample output.
Q: Write a function that takes a string as its only argument and returns a sorted list of characters…
A: Algorithm: start traversing the string S from index 0th element if 'S[i]' is small case alphabets…
Q: Write a Python program that takes a single string as an input from the user where few numbers are…
A: string=input().strip().split(",")l1=[]l2=[]for i in string: if len(i)!=0:…
Q: My problem is to create a function in python that will print out all possible subsequences of a list…
A: Python used to answer this question.
Q: Write a program in Python that first gets a list of integers from input. The input begins with an…
A: Program code: #defining the function get_user_values()def get_user_values(): #prompts the user to…
Q: Please answer it in Python Write a function integerlist that would return Increasing, Decreasing,…
A: Your python program is given below as you required with an output.
Q: Write a program (not a function!) that asks the user for nonnegative integers, one integer per line.…
A: Sample Code Output 1: Sample Code Output 2:
Q: Write a python program that will take two inputs from the user 1st input a string where each number…
A: Python code: #function to check absolute difference exists or notdef findPair(str1, k): #convert…
Q: Write a Python program that reads from the user 10 integers, then goes through the list and check if…
A: Answer: Here I am providing you the python code of your requirement, Please find the code and code…
Q: in python """ Write a function get_new_grades, such that given a string of grades as an input…
A: Below is the code in python and sample output:
Q: Please write the programs in python. Let there are N numbers in a list and that list is said to be…
A: As per our guidelines, we are supposed to answer only one question. Kindly repost the remaining…
Q: Write a function decode_string() that gets a string as a parameter -so called encrypted string-,…
A: Part4: Algorithm: Start Read a string Initialize the dictionary with given data Initialize an empty…
Q: Write a python program that asks a user (business owner) for their product information and creates…
A: # This loop will go on until the budget is integer or floatwhile True: try: bg = float(input("Enter…
Q: In Python Make a function that given an integer list of lists, returns a list of couples such as…
A: Step 1 : Start Step 2 : Define a function myFunction() to return a list of couple where the…
Q: Solve in Python: Write a program that first gets a list of integers from input. The last value of…
A: The problem is based on the basics of loops in python programming language.
Q: create a Python function, called number(Lollntegers), which takes as parameter a list made up of…
A: Program: def number(LollIntegers): # called function recieve the list of integers from calling…
Q: Write a Python program that takes 7 random scores as inputs and appends them to a list (aGrades).…
A: Given: Calculate the number of exams as the length of the list minus one; assign examCount to…
Q: Write a program that reads a list of integers, and outputs whether the list contains all even…
A: Below is the required C++ program: - Explanation: - Including the essential header files and the…
Q: please use python Write a program that first gets a list of integers from input. The input begins…
A: PROGRAM: #defining the function get_user_values() def get_user_values(): #prompts the user…
Q: squares( [[1,2,3],[4,5],[6,7,8,9]]) # 1,4,9 are perfect squares
A: The given query is implemented using python: SOURCE CODE: square_list = [] a = [1,2,3,4,5,6,7,8,9]…
Q: In Python use the Design Recipe to write a function, count_odds, that consumes a list and two…
A: Program Instructions:Write the function header and type contrast of the program.Write description…
Q: Write a Python function called name_processor that takes a list of students' full names and returns…
A: Here I have created a function named name_processor(). In this function, I have iterated over the…
Q: Write the program in python Using a list of integers (which you may code directly into your…
A: Here I have created the function to get the pairs. Inside the function, I have used a loop to…
Q: Write a program that reads an integer, a list of words, and a character. The integer signifies how…
A: The C++ code is followed by a Screenshot of code and output:
Q: a program that reads (alphabetical) input questions (full question) from the user (e.g: what is the…
A: It is defined as the best way to learn Python is by practicing examples. The page contains examples…
Q: Suppose you have a sitting arrangement of the students of the final exam in a list. The list…
A: The programming methodology for the program is given by: Function evenodd which takes sittinglist…
Q: We have to create a program in java in which the below mentioned things should be there- You have…
A: Programs: Programs are used to solve complex problems according to the instructions provided by the…
Q: Complete the calc_average() function that has an integer list parameter and returns the average…
A: The Python program along with the snapshot of code and output is given below:
Q: Write a program in python that reads a list of integers, and outputs whether the list contains all…
A: PROGRAM: #Function definition def is_list_even(my_list): #Iterating list elements for x in…
Q: . At the interactive prompt, define a list named L that contains four strings on numbers (e.g.,…
A: Given that at the interactive prompt, define a list name L that contains four strings or numbers…
Q: Determine whether the sequence of items is strictly ascending so that each element is strictly…
A: The if-else code can be used inside a while loop to check if each element of a list is strictly…
Q: Write a program that reads a list of integers, and outputs whether the list contains all even…
A: PROGRAM: #Function definition def is_list_even(my_list): #Iterating list elements for x in…
Q: Write a program that reads a list of integers, and outputs whether the list contains all even…
A: PROGRAM: #Function definition def is_list_even(my_list): #Iterating list elements for x in…
Q: Write a program that reads a list of integers, and outputs whether the list contains all even…
A: A C++ program that reads a list of integers, and outputs whether the list contains all even numbers,…
Q: Create a function in Python named rare (s) which takes as parameter a integer s, and which returns a…
A: The problem is based on the basics of functions in python programming language.
Q: Write a program in Python including the following function: Write a function which takes a list of…
A: #recursive method to form a number def formNum(lst, n, num): #finding list length l =…
Q: Write a Python program that prompts the user to enter a list of words and stores in a list only…
A: Program: result = [] while True: word = input("Enter a word(enter to exit): ") if word ==…
Step by step
Solved in 2 steps with 1 images
- Write a program in PYTHON with a function longest(L) which examines the argument list L and returns the longest string. You can assume all of the elements of the list L are strings, and that the list is not empty. Use the approach where there is a variable largestyet which is initialized to the first element of L. Then go through the rest of the elements and update largestyet whenever you encounter a longer string. For example, longest(['blue', 'red', 'the old barn', 'the white house', 'green']) would return 'the white house'.Write a python function that takes a list as a parameter. The list consists of scores of 3 sections of the IELTS exam (reading, writing, and speaking in the exact order). The valid score for each section is from 0(inclusive) to 9(inclusive). Thus the valid range of the IELTS average score is from 0(inclusive) to 9(inclusive). Then your function should return the average of the given scores as well as the information according to the provided conditions below. Then, finally print the returned values in the function call.If the average score is Less than 6, then return “Retake the exam”.If the average score is Greater than 6 and less than 8, then return “Good user”.If the average score is Equal to 8, then return “Very good user”.If the average score is Above 8, then return “Expert user”.For any invalid inputs (out of valid range), return “Impossible score!!”.Write a python function that takes a list as a parameter. The list contains all the marks (Pop Quiz, Assignment, Assessment, Final) of a student. Then your function should return the total mark and the grade according to the provided conditions below. Then, finally print the returned values in the function call. If total score is greater than 100 or less than 0 then return “Invalid Marks” If total score is less than 50 then return “F” If total score is greater than or equal 50 and less than 65 then return “D” If total score is greater than or equal 65 and less than 80 then return “B” If total score is greater than or equal 80 and less than 101 then return “A”
- Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither. The input begins with an integer indicating the number of integers that follow. Ex: If the input is: 5 2 4 6 8 10 the output is: all even Ex: If the input is: 5 1 3 5 7 9 the output is: all odd Ex: If the input is: 5 1 2 3 4 5 the output is: not even or odd Your program must define and call the following two functions. IsVectorEven returns true if all integers in the array are even and false otherwise. IsVectorOdd returns true if all integers in the array are odd and false otherwise.bool IsVectorEven(vector<int> myVec)bool IsVectorOdd(vector<int> myVec) #include <iostream>#include <vector>using namespace std; /* Define your function here */ int main() {/* Type your code here. */ return 0;} Please help me with this problem using c++.Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither. The input begins with an integer indicating the number of integers that follow. Ex: If the input is: 5 2 4 6 8 10 the output is: all even Ex: If the input is: 5 1 3 5 7 9 the output is: all odd Ex: If the input is: 5 1 2 3 4 5 the output is: not even or odd Your program must define and call the following two functions. is_list_even() returns true if all integers in the list are even and false otherwise. is_list_odd() returns true if all integers in the list are odd and false otherwise.def is_list_even(my_list)def is_list_odd(my_list) if __name__ == '__main__': both def and if need to be included and functions called from both defs def is_list_even(my_list):for i in range(len(my_list)):if my_list[i] % 2 != 0:return False or Truedef is_list_odd(my_list):for i in range(len(my_list)):if my_list[i] % 2 == 0:return False or Trueif is_list_odd == True:print("all…in python """Write a function get_new_grades, such that given a string of grades as an input parameter,returns two objects:the initial grades as a list of numerical valuesas well asa new list with the numerical values, where the scores that are less than 50 are replaced by 50. """
- for my python class, I need to write a program that has a list that stores repeated heart-rate measurements for the same patient over several tests heart_rate = [ [ 72, 75, 71, 73], # resting[ 91, 90, 94, 93], # walking slowly[ 130, 135, 139, 142], # running on treadmill[ 120, 118, 110, 105, 100, 98]] # after minute recovery i need to defien a function calculate_average_heart_rates() which accepts the list heart_rate as its only input argument.How to write a function in python where it takes a list of string s. Where s= ["hello","lazyness","polite","politness"]. The function takes the string s as input and returns a string that is the longest even length string that ends with "ness". But if there is no string that ends with "ness" then an empty string is returned.Write a program in Python with a function biggestBuried(s), which the parameter s is a string, and the function returns the largest integer buried in the string. If there is no integer inside the string, then return 0. For example, biggestBuried('abcd51kkk3kk19ghi') would return 51, and biggestBuried('kkk32abce@@-33bb14zzz') would return 33, since the '-' character is treated like any other non digit. print(biggestBuried('abcd51kkk3kk19ghi')) answer should be 51 print(biggestBuried('kkk32abce@@-33bb14zzz')) answer should be 33 print(biggestBuried('this15isast22ring-55')) answer should be 55
- Write a python 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 to sort 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.75Write the code in python to define a function has_repeat(mystr), which takes a string parameter and returns a boolean result. - If mystr has a character that is repeated (count is more than 1 for that character), return True - Otherwise, return False Hint: You can solve this problem by iterating over the characters in mystr and comparing each character's count with 1. For example: Test Result print(has_repeat("Happy")) True print(has_repeat("sad")) False print(has_repeat("salmons")) True print(has_repeat("Trouts")) FalseIn Python Use the Design Recipe to write a function bools_2_str, which consumes a list of booleans and returns a string of the same length as the list. Where the list has True, the string should have 'X', and where the list has False, the string should have ' ' (i.e., a single space).