import re def lexical analyzer (expression): # regular expression that matches digits, alphabets, and characters pattern = '\d+|[a-zA-Z]+[^\s\d+a-zA-Z]+' #regular expression new_exp = re.findall (pattern, expression) #using builtin function findall return new_exp #Test the lexical analyzer expression = input("Enter an expression: " tokens = lexical_analyzer (expression) print (tokens)
Q: In Haskell: Code a function "rangeProduct" that computes according to the following examples .…
A: Algorithm without recursion: Check if the second argument is smaller than the first. If it is,…
Q: 1. Write a program to convert the time from 24-hour notation to 12-hour notation. Your program must…
A: ''Since you have asked multiple questions, we will solve the first question for you. If you want…
Q: a. Use an interactive Python session (shell/IDLE) to print out a line of 11 stars 7 times (so there…
A: Answer (a): Algorithm : Create a for loop that iterates 7 times Within the for loop, use the…
Q: GIS stands for _________. Select one: a. Geological Information System b. Green Information System…
A: Answer : GIS stands for Geographic information system It is one of the type of database in which…
Q: implement a data structure that supports stack operations (push and pop) and also return-the-maximum…
A: Dear Student, The required source code with implementation and expected output is given below -
Q: 50 Which issue is an ethical problem, as opposed to a legal one, concerning web pages? O Trademark…
A: Answer Trademark infringement
Q: Let E : y2 = x3 + 3x + 4 be an elliptic curve over F37. (a) Find all the elements of the…
A: According to the information given:- We have to find out all the elements of the elliptice curve…
Q: public class Test { public static void main(String[] args) } } int[] [] m1 = {{14, 11, 13, 12), {…
A: Algorithm: Start Declare two 2D arrays m1 and m2 Print “First array:” Call the method…
Q: Considering the following ERD, which tables and fields (i.e., columns) you don't need to access in…
A: The above question is solved in step 2 :-
Q: 5. Outside of VS Code, double-click the Chapter 02/Guided Practice Ch 2/home-text .txt file to open…
A: Approach Start Declare doctype Open html and add attribute head element with meta element for…
Q: 4. Consider the regular expression below which is supposed to describe morphological facts about…
A: According to the information given:- We have to follow the mentioned regular expression in order to…
Q: program created, apply a case system using cases that will let the user choose from the above…
A: We need add a menu that will display a menu and then allows us to select the operation and perform…
Q: What wrong with the code? code = input("Enter the coded text: ") distance = int(input("Enter the…
A: An explanation is given below why your code is incorrect Your code produces the following output
Q: When authentication requires more than one piece of information (factor), we call this,... Group of…
A: Authentication is the process of determining whether someone or something is, in fact, who or what…
Q: how can the relationship between laptop and it's screen can best be categorized? 1. Polymorphism…
A: Ownership (Composition or Aggregation)- It would best categorize the relationship between a laptop…
Q: Given four values representing counts of quarters, dimes, nickels and pennies as inputs, output the…
A: Program Approach:- 1. Take input and store values in the variables quart = int(input())dim =…
Q: Given two sorted arrays a[] and b[], of lengths n1 and n2 and an integer 0≤k<n1+n2, design an…
A: Solution: The given problem can be Solved by Divide And Conquer Approach very efficiently: We can…
Q: The following class represents a 3d shape using an array of 3dPoints. It is intended to be…
A: You are correct that the function setPoints needs to be carefully implemented or removed to make the…
Q: Consider the pseudo-code below: ALGORITHM MaxElement(A[0..n - 1]) //Determines the value of the…
A: Below is the complete solution with explanation in detail for the given question about time…
Q: When the following expression is evaluated, the result will be what Java data type? -93.9f* 58.9f 1)…
A: Given, The expression=-93.9f * 58.9f Here, f represents float. The boolean data type is used to…
Q: Which inter-cluster similarity metric does this line represent? MIN MAX ARGMIN Group MIN Aggregated…
A: According to Bartleby Guidelines we need to answer only one question so I have answered first…
Q: You and your teammate decided to create a system to predict fires and gas leaks and turn on an alarm…
A: The system uses sensors to detect the presence of a fire or gas leak, as well as a motion sensor to…
Q: Consider the grammar, G: S⇒ aAalbBb AaAalb BbBbla Mark the correct description(s) of the language…
A: In the given problem, set of production rules are given for a particular grammar and by following…
Q: You are given n integer numbers (n> 2), operators (+ - *), and a goal number. You will use the given…
A: Please refer to the following step for the complete solution to the problem above.
Q: ng java programming language: Create frame 400x200, then create a button that's 200x200 and panel…
A: Here is the solution of how you could create a frame, button, and panel in Java using the JavaFX…
Q: Use a Karnaugh map to find the minimum SOP form for each expression a. ABC + ABC + ABC b. AC (B + C)…
A: First, we will draw the truth table of the expression. Then we will create the k-map. Using a K-map,…
Q: What is the price of a house with size 60 m2 if we use a KNN model with k=2.
A: a. To find the price of a house with size 60 m2 using a KNN model with k=2, we will first find the…
Q: I Want Code C++ and screenshot outputs Write 14 C++ statements that… 1. Declare a string variable…
A: Algorithm 1: START Declare string variable color Set color = "Red" Declare two pointer variables…
Q: With the Il operator, command1 is executed and command2 is executed if, and only if? O Command1 is…
A: Operator: An operator in computer science is a symbol or set of symbols that are used to…
Q: nage should be black if the number n is not prime and white if the number n is prime. ndex your…
A: This Following creates a 2-dimensional numpy array of shape (50,50) that is initially empty and is…
Q: Write a C++ program that read number of elements in a set first and then your program should read…
A: Read the number of elements in a set. Read the elements of the set. Iterate through all integers…
Q: Q3) what is the purpose of the follo 1.LLC 2.CRC 3.logical addressing
A: According to the policy we can only give the answer of first three questions, repost your remaining…
Q: Internet Protocol (IP) address is a network layer protocol address for a host in a Transmission…
A: (d) IP address classes are used to divide IP addresses into different ranges for use in different…
Q: *4.25 (GENERATE VEHICLE PLATE NUMBERS) Assume that a vehicle plate number consists of three…
A: Java program to generate the number plate with three character (uppercase) and four digits. see the…
Q: • Declare a 1-dimensional array of type integer with components. 10 • Fill array elements from the…
A: Algorithm: Start Create an array of size 10 For loop, iterating through the array Ask the user to…
Q: You are given the discrete logarithm problem 2x ≡ 6 (mod 101) Solve the discrete logarithm problem…
A: According to the information given:- We have to define discrete logarithm problem by using (a) Brute…
Q: // Use pointer p to traverse the 2D array of characters variable 'strings' (input from user in…
A: Source code of program #define NUM_STRINGS 4#define STRING_LENGTH 35 #include…
Q: Provide a detailed explanation line by line. Explain how this C++ program functions Source Codes…
A: check the explanation below
Q: Which line of code results in a background color of green? Obody [background-color:green;] Obody…
A: Introduction: CSS (Cascading Style Sheets) is a style sheet language used to define the look and…
Q: (a) What is the port size in an IP address and how can determine the class with bits? Explain with…
A: The transport Layer uses a port number to deliver messages from one process to another process. A…
Q: What is the purpose of XML? O Describes markup Formats content for printing Describes data elements…
A: XML stands for Extensible Markup Language. It's somewhat like HTML, a markup language. But, In HTML…
Q: How to write hello world program in javascript
A: Below is javascript code with screenshot of output. In javascript we can output "Hello world" to…
Q: Suppose you have a RISC machine with a 2.7 GHz clock (i.e., the clock ticks 2.7 billion times per…
A:
Q: bd, 1sure.
A: Here There are two types of INSERT INTO statement forms. The first form doesn't specify the column…
Q: Lab4- Write the program to input a positive integer and print the largest number whose square is…
A: The below program will take a positive integer and print largest number whose square is less than…
Q: Block ciphers are less common in symmetric encryption algorithms Group of answer choices True…
A: Introduction: Using a cryptographic algorithm and key to encrypt data in blocks, a block cypher is a…
Q: In haskell: Write a function for lists named "init" that uses the built-in reverse function to…
A: In this implementation, we use the reverse function to reverse the order of the elements in the…
Q: C++ Programming. Construct parent class with the specified in individual task (Table 1) fields and…
A: The idea behind the program is to create a parent class "Automobile" with specific fields and…
Q: Using recursion and java, please make a sierpenski carpet Please also comment the code just like the…
A: In this question, it is asked to draw the sierpenski carpet using the recursive java program.…
Q: Write a C/C++ program that asks the user for three integer marks. These are the student marks out of…
A: The source code of the program #include<iostream>#include<iomanip>using namespace…
TASK:
Explain this PYTHON code in Simple English, each and every step the working etc.
Explain Functions and library used, Use STEPS (1,2...) and POINTS to EXPLAIN
Step by step
Solved in 2 steps
- Modify LiveExample 12.12 EvaluateExpression.cpp to add operators ^ for exponent and % for modulus. For example, 3 ^ 2 is 9 and 3 % 2 is 1. The ^ operator has the highest precedence and the % operator has the same precedence as the * and / operators. For simplicity, assume the expression has at most one ^ operator. Sample Run: Enter an expression: (5 * 2 ^ 3 + 2 * 3 % 2) * 4 (5 * 2 ^ 3 + 2 * 3 % 2) * 4 = 160 Code posted below, c++ please! #include <vector>#include <iostream>#include <cmath>using namespace std; #ifndef STACK_H#define STACK_H template<typename T>class Stack{public: Stack(); bool empty() const; T peek() const; void push(T value); T pop(); int getSize() const; private: vector<T> elements;}; template<typename T>Stack<T>::Stack(){} template<typename T>bool Stack<T>::empty() const{ return elements.size() == 0;} template<typename T>T Stack<T>::peek() const{ return…Repost Please help me explain the whole program step by step such as explain all the functions, the element, the operation, all the struct functions and so on. The coding: #include<iostream>#include<iomanip>#include<ctype.h>#include<string.h>using namespace std; struct nodeWords{ char words[100]; struct nodeWords* next;};struct undoWords{ char unwords[100]; struct undoWords* next;};undoWords* untop;undoWords* newundoNode; nodeWords* top; //these pointers are used to hold the linked list.nodeWords* current; //use for traversalnodeWords* newNode; //use to create new node for new recordnodeWords* pop; void Push() //push an element into the stack{ char answer; do { newNode = new nodeWords; cout << "\nWrite what's in your mind.." << endl; cout << "Your words > "; cin >> ws; cin.getline(newNode->words, 100); newNode->next = top; top = newNode; cout…In cell C18 type a VLOOKUP function to find the corresponding letter grade (from column D) for the name in A18. The table array parameter is the same as in B18. Type FALSE for the range lookup parameter. Copy the formula in C18 to C19:C22Notice this formula works correctly for all cells. Range lookup of FALSE means do an exact match on the lookup value whether or not the table array is sorted by its first column. In cell E11, type an IF function that compares the score in B11 with the minimum score to pass in A5. If the comparison value is true, display Pass. Otherwise, display Fail. Copy the formula in E11 to E12:E15. Did you use appropriate absolute and relative references so the formula copied properly? In cell F11, type an IF function that compares the grade in D11 with the letter F (type F). If these two are not equal, display Pass. Otherwise, display Fail. Copy the formula in F11 to F12:F15
- Here is my entire code(average is not working yet). The response I got from the professor is that I have to create a DRY solution replacing the five display_functions with a single get_array function you call five times like common_array = get_array(plant_xml, "COMMON") etc. from urllib.request import urlopenfrom xml.etree.ElementTree import parse def read_data(data_file): plant_url = urlopen(data_file) plant_xml = parse(plant_url) return plant_xml def display_common_items(plant_xml): plant_root = plant_xml.getroot() common_array = [] for item in plant_root.findall("PLANT"): common_array.append(item.find("COMMON").text) return common_array def display_botanical_items(plant_xml): plant_root = plant_xml.getroot() botanical_array = [] for item in plant_root.findall("PLANT"): botanical_array.append(item.find("BOTANICAL").text) return botanical_array def display_zone_items(plant_xml): plant_root = plant_xml.getroot() zone_array = []…#The Iris Dataset import sklearn.datasetsimport matplotlib.pyplot as plt import numpy as np import scipy iris = sklearn.datasets.load_iris() Write a function that takes in an index i and prints out a verbose desciption of the species and measurements for data point i. For example:Data point 5 is of the species setosaIts sepal length (cm) is 5.4Its sepal width (cm) is 3.9Its petal length (cm) is 1.7Its petal width (cm) is 0.4IN SCALA COULD YOU COMPLETE THE FOLLOWING FUNCTIONS: // Regular Expressionsabstract class Rexpcase object ZERO extends Rexpcase object ONE extends Rexpcase class CHAR(c: Char) extends Rexpcase class ALTs(rs: List[Rexp]) extends Rexp // alternatives case class SEQ(r1: Rexp, r2: Rexp) extends Rexp // sequencecase class STAR(r: Rexp) extends Rexp // star // some convenience for typing regular expressions //the usual binary choice can be defined in terms of ALTsdef ALT(r1: Rexp, r2: Rexp) = ALTs(List(r1, r2)) import scala.language.implicitConversions import scala.language.reflectiveCalls def charlist2rexp(s: List[Char]): Rexp = s match { case Nil => ONE case c::Nil => CHAR(c) case c::s => SEQ(CHAR(c), charlist2rexp(s))}implicit def string2rexp(s: String): Rexp = charlist2rexp(s.toList) implicit def RexpOps (r: Rexp) = new { def | (s: Rexp) = ALT(r, s) def % = STAR(r) def ~ (s: Rexp) = SEQ(r, s)} implicit def stringOps (s: String) = new { def | (r:…
- please only c code dont use c++ and c#. * Function: write the compare_restaurants_ascending function according to the given parameters. #include <stdio.h>#include <stdlib.h>#include <string.h> #define N 2000#define D 250 // A simple restaurant structuretypedef struct{char restaurant_name[15];double rating;char city[31];unsigned short opening_year;} RESTAURANT_t, *RESTAURANT; // Arraylist structuretypedef struct ArrayList_s{void **list;int size;int capacity;int delta_capacity;} ArrayList_t, *ArrayList; *Function: compare_restaurants_ascending* This function compares given restaurants with respect to first their ratings and then their names. It returns - 1, if rest1 > rest2 - -1, if rest1 < rest2 - 0, if rest1 = rest2*/int compare_restaurants_ascending(void *rest1, void *rest2){// TODO: Fill this block. }Write a function in c language that takes your student number as a value and adds each digit ofyour student number into 2 different dynamic arrays according to whether they are odd oreven(one array for the odd digits and another one for the even digits), and displays the odd andeven values in the dynamic arrays separately.Student number:2015710213035Example: Input: Student Number : 25698574Output: Result: 7 5 9 54 8 6 2test_var = 'AAMMTTMT';//test_var is testing variable takenarray = test_var.split('');//string is split into the array function SWAP(TAM, i, j)//function to swap{temp = TAM[i];TAM[i] = TAM[j];TAM[j] = temp;}function sort_AMT(TAMUK)//function to sort the array{for(i = 0; i<TAMUK.length;i++){for(j = 0; j<TAMUK.length-1;j++){if(TAMUK[i]<TAMUK[j])SWAP(TAMUK,i,j);}}console.log(TAMUK);} sort_AMT(array);//function call How to write an HTML code for this javascript result/output? where the result will be displayed in HTML page.
- test_var = 'AAMMTTMT';//test_var is testing variable takenarray = test_var.split('');//string is split into the array function SWAP(TAM, i, j)//function to swap{temp = TAM[i];TAM[i] = TAM[j];TAM[j] = temp;}function sort_AMT(TAMUK)//function to sort the array{for(i = 0; i<TAMUK.length;i++){for(j = 0; j<TAMUK.length-1;j++){if(TAMUK[i]<TAMUK[j])SWAP(TAMUK,i,j);}}console.log(TAMUK);} sort_AMT(array);//function call Can I have this program output and code in HTML page?please only c code dont use c++ and c#. Function: write the compare_restaurants_descending function according to the given parameters. #include <stdio.h>#include <stdlib.h>#include <string.h> #define N 2000#define D 250 // A simple restaurant structuretypedef struct{char restaurant_name[15];double rating;char city[31];unsigned short opening_year;} RESTAURANT_t, *RESTAURANT; // Arraylist structuretypedef struct ArrayList_s{void **list;int size;int capacity;int delta_capacity;} ArrayList_t, *ArrayList; * Function: compare_restaurants_descending* This function compares given restaurants with respect to first their ratings and then their names. It returns 1, if rest1 < rest2 -1, if rest1 > rest2 0, if rest1 = rest2*/int compare_restaurants_descending(void *rest1, void *rest2){ // TODO: Fill this block. }Write the implementations of functionscopy1 and copy2 for copying strings. copy1 uses array index notation. copy2 uses Pointers andPointer Arithmetic.#include <stdio.h>#define SIZE 10void copy1(char* s1, const char* s2); // prototypevoid copy2(char* s1, const char* s2); // prototypeint main(void){char string1[SIZE]; // create array string1char *string2 = "Hello"; // create a pointer to a stringcopy1(string1, string2);printf("string1 = %s\n", string1);char string3[SIZE]; // create array string3char string4[] = "Good Bye"; // create an array containing a stringcopy2(string3, string4);printf("string3 = %s\n", string3);}void copy1(char* s1, const char* s2){//Implement copying string using array index notation}void copy2(char* s1, const char* s2){//Implement copying string using Pointers and Pointer Arithmetic }