Q7. The output of the following code is 'University'. import re pattern University' seekerking = "Tiengeng University, Tianjin University, Nankai, University" results (pattern, if getti print (()) print ('no match') else:
Q: void sierpinski (float x1, float yl, float x2, float y2, float x3, float y3, int iterations // The…
A: It is defined as an interpreted, object-oriented, high-level programming language with dynamic…
Q: As part of this assignment, the program that you will be writing will store current grades in a…
A: Introduction Dictionary: In Python, a dictionary is a built-in data type that is used to store and…
Q: Multiple key-value pairs, each representing a hotel room number and current temperature, are read…
A: The objective of the question is to sort the dictionary 'room_temperatures' by keys and print the…
Q: Arrays Write a for loop to print all elements in courseGrades, following each element with a space…
A: Programming instructions: First, initialize the variable which takes the size of the array and an…
Q: Q3 Let L = {bab, ab, ???}. If |L²| = 8, what is a possible value of the unknown third element of L?…
A: Introduction: In computer science, a language L refers to a set of strings or sequences of symbols…
Q: # Put the code below # consider using np.where() method to preprocess "Sex" column. # replace F in…
A: The objective of the question is to preprocess the 'Sex' column in a dataframe using the np.where()…
Q: Provide the following functions in daily_winners.py: add winnerlist.atscores listot.plavers.…
A: For the above problem the solution code can be found in Step 2, which is consisting of the following…
Q: When I type in the code for the 3rd question this line is highlighted if (people[i][j] == first){…
A: Equal to sign does not work with the strings. We need to use equals() function for comparing.
Q: Given: a variable current_members that refers to a list, and a variable member_id that has been…
A: Step-1: StartStep-2: Declare a list current_members with value ['123', '246', '789']Step-3: Declare…
Q: #In the lines below, I wrote a quick program used to simulate a stock price over two years. As an…
A: Step 1 of 1 Code import numpy as np vec =…
Q: Modify short_names by deleting the first element and changing the last element to Joe. Sample…
A: Below is the code in python as language not specified and sample output:
Q: Use pseudocode in designing the logic. Laramie Park District has files of participants in its…
A: Pseudocode:- Pseudocode resembles program code however without being restricted to the syntax of an…
Q: Write a for loop to print all elements in courseGrades, following each element with a space…
A: Here is the c++ code: See below step
Q: It outputs as Enter dish information (name, calories, price, is_vegetarian, spicy_level): Maybe…
A: Solution: Given, Enter dish information (name, calories, price, is_vegetarian, spicy_level):…
Q: The following code doesn't correctly return the index values of the minimum contiguous subsequence.…
A: In this question we have to write a python code and even modify the given code to generate correct…
Q: Use an enhanced for loop to process a vararg parameter because
A: Since Varargs is a variable-length argument which is specified by 3 dots(...). Thus, this will…
Q: PYTHON In order to parse data to start a simulation, users must enter data correctly. Suppose…
A: code :-- # fucntion to check parsing def check(soil_key,soil_data): # first remove extra spaces…
Q: text1 = """ Python is an amazing programming language. It is also one of the primary languages in…
A: In this question we have been given with the python code which is not completed for the function…
Q: A3 = {w ∈ {1,0}* | every odd position in w is an 1}. Provide regular expression. explain in detail…
A: The regular expression that represents the language A3 = {w ∈ {1,0}* | every odd position in w is a…
Q: In the composer array, create a statement that copies the string "Beethoven."
A: STATEMENT: This statement copies the string Beethoven into the composer array. stripy is the…
Q: Javascript: Using the data set as a pre-defined variable in your program, write code that uses the…
A: Below is the implemented function main() which displays the required values using the methods…
Q: To receive full marks on this function, your solution must not remove any keys from the parameter…
A: In this question we have to write and complete a function called update_amounts which takes a…
Q: Modify short_names by deleting the first element and changing the last element to Joe. Sample…
A: There is one python program given and we have to edit it according to the needs given. Program…
Q: Problem You have a module that you would like to split into multiple files. However, you would like…
A: I used python language for this. Question :-
Q: The Iris Dataset import sklearn.datasets import matplotlib.pyplot as plt import numpy as np import…
A: Q: Write a function that takes in an index i and prints out a verbose desciption of the species and…
Q: In Pyton, Use the sort_values() method and ask user to enter values for all its three arguments…
A: Your python program is given below as you required with an output.
Q: Compute the proportion of the general public that has an IQ of 87 or above. import numpy as np from…
A: Lets discuss the solution in the next steps
Q: Assignment 5A: Multiple Frequencies. In the last assignment, we calculated the frequency of a coin…
A: - The question is to calculate the frequency of a randomly generated sequence. - We are using python…
Q: Notice that all of the data in the inner lists are represented as strings. You are to write the…
A: Step 1: Define is_number() function which checks whether the passed value is a number and returns…
Q: Write a program that can be used by a ski resort to keep track of local snow conditions for one…
A: The code is written below: #include <iostream> #include <string> using namespace std;…
Q: As part of this assignment, the program that you will be writing will store current grades in a…
A: Below is the complete solution with explanation in detail for the given question in Python…
Q: // Computes the intersection of listl and list 2 and store it in result // Result must be sorted in…
A: Define the doIntersection function that takes three arguments: two constant lists list1 and list2,…
Q: String replacement is read from input. Then, sentence is read from input. If replacement is in…
A: The objective of the question is to perform certain operations on a string based on the user input.…
Q: ‘for’ loop to calculate ‘sum2’ (sum of all elements of column ‘2’) and ‘sum3’ (sum of all elements…
A: Task : Find the sum of columns 2 and 3. Check the sum for the greater value.
Q: Consider the following equation for the sum of a finite arithmetic series: Sm where n is the number…
A: As no programming language is mentioned, it is solved using JAVA
Q: Given 2 strings, return their concatenation, except remove the last character of each and swap the…
A: I have provided C++ CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOTS-----------------
Q: Not allowed to add variables in brackets next to originIndex * @return index of the point…
A: ALGORITHM:- 1. Calculate the distance of the points from the origin. 2. Return the point with…
Q: In cell C18 type a VLOOKUP function to find the corresponding letter grade (from column D) for the…
A: Use the formula in Cell D11 to Populate Grades First. =VLOOKUP(B11,$A$3:$B$8,2,1) 1. The formula 2.…
Q: Write a for loop to print all elements in courseGrades, following each element with a space…
A: Here is the c++ code. see below step for code.
Q: Write a program that modifies the male_names set by removing a name and adding a different name.…
A: The algorithm of the code:- Step 1: Define a set of male names.Step 2: Ask the user for a name to…
Step by step
Solved in 4 steps with 2 images
- Write a single line of code to generate a random number from the following set: (hint look for the pattern and the range). 6, 11, 16, 21, 26FIX THIS CODE Using python Application CODE: import csv playersList = [] with open('Players.csv') as f: rows = csv.DictReader(f) for r in rows: playersList.append(r) teamsList = [] with open('Teams.csv') as f: rows = csv.DictReader(f) for r in rows: teamsList.append(r) plays=len(playersList) for i in range(plays): if playersList[i]['team']=='Argentina' and int(playerlist[i]['minutes played'])<200 and int(playersList[i] ['shots'])>20: print(playersList[i]['last name']) c0=0 c1=0 c2=0 for i in range(len(teamsList)): if int(teamsList[i]['redCards'])==0: c0=c0+1 if int(teamsList[i]['redCards'])==1: c1=c1+1 if int(teamsList[i]['redCards'])==2: c2=c2+1 print("Number of teams with zero redcards:",c0) print("Number of teams with zero redcards:",c1) print("Number of teams with zero redcards:",c2) ratio=0 for i in range(len(teamsList)): if int(teamsList[i]['games']>3) and if int(teamsList[i]['goalsFor'])/int(teamsList[i]['goalsAgainst'])<ratio:…Regex, APIs, BeautifulSoup: python import requests, refrom pprint import pprintfrom bs4 import BeautifulSoup complete the missing bodies of the functions below: def mathmatic(target):"""Question 1You are doing fun math problems. Given a string of combination of '{}', '[]','()', you are required to return the substring included by the outermost '{}'.You need to write your code in one line.Args:target (str): the string to search inReturns:str>>> mathmatic('{[[[[]()]]]}')'[[[[]()]]]'>>> mathmatic('[(){([{}])}]')'([{}])'"""pass test code: # print(mathmatic('{[[[[]()]]]}'))# print(mathmatic('[(){([{}])}]'))
- From the code supplied by the tutor, modify it so that: 1. Ask what kind of animal it is (for example, carnivore, herbivore, and omnivore) When prompting for the information, it is saved in a list for each of the three animal types (for example, lions in carnivores, bears in omnivores, giraffes in herbivores) and they are saved depending on the number that the user adds in each list. 2. At the end, a list of lists is printed that presents the data of each of the saved animals according to their type.Can you annotate this code. cars = ["Buick","Ford","Honda"]colors = ["Red","Blue","Black","White","Green"]aType = ["Sedan","SUV","Sports","Coupe","Truck"]arr = [[0 for i in range(len(cars))] for j in range(len(cars)*len(colors))]for i in range(0, len(colors)*len(cars)):for j in range(0, len(cars)):if j == 0:arr[i][j] = cars[int(i/5)]if j == 1:arr[i][j] = colors[int(i % 5)]if j == 2:arr[i][j] = aType[int(i % 5)]for i in range(0, len(arr)):print(arr[i])Complete the Swap() method in main.c to exchange the values of the num field of two Number struct objects, num1 and num2.
- In C#: Run the following console application. This program should produce the union of two sets, but has several errors. Use a variety of debugging techniques to locate and correct the errors. NOTE: A set is a collection of like elements that does not contain any duplicates. The union of two sets is the set that contains all the elements in both sets. Formally: A union B = {x : x Î A or x Î B}read: A union B is the set of all x such that x is in A or x is in B Example: A = {1,2,3,4,5} and B = {2,4,6,8}, then A union B = {1,2,3,4,5,6,8} (notice, no duplicates!) Debug the program. When you find an error, comment out the offending line, give an explanation of the error, write a corrected line, and include a screenshot of your program running with successful output. Submit the modified files and screenshots of any breakpoints you use. Program using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace…The function count_contains_og in python takes a list of strings and returns how many strings in the list contain 'og' / 'OG' / 'oG' / 'Og' (check for 'og', ignoring case). Hint: Use the sequence membership operator in to help you check for 'og' in the individual strings. Create a lower-cased version of the string (lower), then use the in operator. For example: Test Result str_list = ['cat', 'dog', 'FROG', 'monkey'] print(count_contains_og(str_list)) 2 strlist = ["X", "x"] print(count_contains_og(strlist)) 0 list_of_one_og = ["Doggie"] print(count_contains_og(list_of_one_og)) 1def findOccurrences(s, ch): lst = [] for i in range(0, len(s)): if a==s[i]: lst.append(i) return lst Use the code above instead of enumerate in the code posted below. n=int(input("Number of rounds of Hangman to be played:")) for i in range(0,n): word = input("welcome!") guesses = '' turns = int(input("Enter the number of failed attempts allowed:")) def hangman(word): secrete_word = "-" * len(word) print(" the secrete word " + secrete_word) user_input = input("Guess a letter: ") if user_input in word: occurences = findOccurrences(word, user_input) for index in occurences: secrete_word = secrete_word[:index] + user_input + secrete_word[index + 1:] print(secrete_word) else: user_input = input("Sorry that letter was not found, please try again: ") def findOccurrences(s, ch): return [i for i, letter in enumerate(s) if letter == ch] *** enumerate not discussed in…
- As part of this assignment, the program that you will be writing will store current grades in a dictionary using course codes as keys and with values consisting of percent grades in lists. The main functions of this program are to print a student's gradebook, to drop the lowest grade in each course, print the student's gradebook again, drop the course with lowest average, and finally printing the student's gradebook again. This program requires a main function and a custom value-returning function. In the main function, code these basic steps in this sequence (intermediate steps may be missing): start with an empty dictionary that represents a gradebook and then use a while loop to allow the input of course codes from the keyboard. End the while loop when the user presses enter without entering data.within the while loop:for each course entered, use a list comprehension to generate five random integers in the range of 70 through 100. These random integers in a list represent the…please name this cards.py. You may use the following code in your program: import random SUITS = "♠ ♡ ♢ ♣".split()RANKS = "2 3 4 5 6 7 8 9 10 J Q K A".split() def create_deck(shuffle=False): """Create a new deck of 52 cards""" deck = [(s, r) for r in RANKS for s in SUITS] if shuffle: random.shuffle(deck) return deck This code creates a random deck of cards (each card is a tuple consisting of a rank and suit). You are to ask the user how many 5-card hands to play and will keep track of the following poker hands. You will need to reshuffle the deck as many times as necessary to get the required number of hands. An example run of the program is as follows. Enter the number of hands to deal: 10000Hand % of Hands Hands of Type2 of a kind 41.290% 4129 3 of a kind 1.970% 197 4 of a kind 0.010% 1 2 pair 4.860% 486 Full house 0.150% 15 Flush 0.220% 22 If you deal enough…In python: student_dict is a dictionary with students' name and pedometer reading pairs. A new student is read from input and added into student_dict. For each student in student_dict, output the student's name, followed by "'s pedometer reading: ", and the student's pedometer reading. Then, assign average_value with the average of all the pedometer readings in student_dict..