Answer:
Explanation:
The following is written in Python. The function takes in a string as a parameter. It then sperates the string at every space. Then it rejoins the list of strings with hyphens. Finally, returning the newly created string with hyphens.
def chain_words(str):
string_split = str.split(" ")
seperator = '-'
hyphen_string = seperator.join(string_split)
return hyphen_string
You have been given an encrypted copy of the Final exam study guide here, but how do you decrypt and read it???
Along with the encrypted copy, some mysterious person has also given you the following documents:
helloworld.txt -- Maybe this file decrypts to say "Hello world!". Hmmm.
hints.txt -- Seems important.
In a file called pa11.py write a method called decode(inputfile,outputfile). Decode should take two parameters - both of which are strings. The first should be the name of an encoded file (either helloworld.txt or superdupertopsecretstudyguide.txt or yet another file that I might use to test your code). The second should be the name of a file that you will use as an output file. For example:
decode("superDuperTopSecretStudyGuide.txt" , "translatedguide.txt")
Your method should read in the contents of the inputfile and, using the scheme described in the hints.txt file above, decode the hidden message, writing to the outputfile as it goes (or all at once when it is done depending on what you decide to use).
Hint: The penny math lecture is here.
Another hint: Don't forget about while loops...
Answer:
Explanation:
Python program
You are given the following text file called Mytext.txt. Write a Python function called search_file that accepts the name of the file (i.e. filename) and a string to look for in the file (i.e. mystring) as parameters. The function then looks for mystring in the file. Whenever it finds the string in a line, it saves the line number and the text for that line in a dictionary. Finally, it returns the dictionary after reading all the lines in the file and populating the dictionary with all matching line numbers and line text. If an empty string or a blank string is passed as mystring then an empty dictionary is returned.
Sample Input: search_file("Mytext.txt","python")
Sample Input: search_file("Mytext.txt","")
Contents of Mytext.txt
Python is an interpreted, high-level, programming language.
Python is dynamically typed and garbage-collected.
Python was conceived in the late 1980s.
Python 2.0, was released in 2000.
Python 3.0, was released in 2008.
The interpreters are available for many operating systems.
Answer:
The function in Python is as follows:
def search_file(filename,mystring):
my_dict = {}
count = 0
file = open(filename)
lines = file.readlines()
for line in lines:
count+=1
if mystring.lower() in line.lower():
my_dict[count] = line.rstrip('\n')
return my_dict
Explanation:
This defines the function
def search_file(filename,mystring):
This initializes an empty dictionary
my_dict = {}
This initializes the number of lines to 0
count = 0
This opens the file
file = open(filename)
This reads the lines of the file
lines = file.readlines()
This iterates through the lines
for line in lines:
This increments the number line
count+=1
This checks if the string exists in the line
if mystring.lower() in line.lower():
If yes, the line number and the string are added to the dictionary
my_dict[count] = line.rstrip('\n')
This returns the dictionary
return my_dict
what connect webpages?
Answer:
"Hypertext links are those words that take you from one web page to another when you click them with your mouse. Although the same HTML tag you study in this hour is also used to make graphical images into clickable links, graphical links aren't explicitly discussed here" I got this from https://www.informit.com/articles/article.aspx?p=440289 sorry I couldnt take the time myself here to help :(
Explanation:
Which tab should you click if you want to access the Show All Comments option in a worksheet?
Home
Page Layout
Review
View
Answer: Review
Because you want to review the comments
Answer:
C.) Reivew
Explanation:
Doing it on EDG now!
Best luck to yall :3
Have a good day and byee
PLEASE HELP ME FIX THIS CODE.
I WANT IT TO HAVE USER INPUT TO CHANGE AND IMAGE FILTER TO BLUE RED OR GREEN.
user_color = input("What color would you like to paint the canvas, blue, red or green?:")
def user_red(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def user_green(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def user_blue(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def custom_filter(image, user_color):
for x in range(image.get_width()):
for y in range(image.get_height()):
pixel = image.get_pixel(x,y)
new_colors = invert_pixel(pixel)
image.set_red(x, y, new_colors[0])
image.set_green(x, y, new_colors[1])
image.set_blue(x, y, new_colors[2])
return image
def change_image():
global image
image = custom_filter(image, user_color)
timer.set_timeout(change_image, IMAGE_LOAD_TIME)
PLEASE HELP ME FIX THIS CODE.
I WANT IT TO HAVE USER INPUT TO CHANGE AND IMAGE FILTER TO BLUE RED OR GREEN.
user_color = input("What color would you like to paint the canvas, blue, red or green?:")
def user_red(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def user_green(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def user_blue(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def custom_filter(image, user_color):
for x in range(image.get_width()):
for y in range(image.get_height()):
pixel = image.get_pixel(x,y)
new_colors = invert_pixel(pixel)
image.set_red(x, y, new_colors[0])
image.set_green(x, y, new_colors[1])
image.set_blue(x, y, new_colors[2])
return image
def change_image():
global image
image = custom_filter(image, user_color)
timer.set_timeout(change_image, IMAGE_LOAD_TIME)
Design a Python3 function to compare every prefix of a string X to every element of string Y, if there is a match, place it in a python set, sort and reversely sort the set, and return the sorted and reversely sorted sets.
Answer:
The function is as follows:
def compare_prefix(strX,strY):
prefix=set()
for i in range(len(strX)):
for j in range(i+1,len(strX)):
chk =strX[i:j+1]
if chk in strY:
prefix.add(chk)
sort_prefix = sorted(prefix)
rev_sort_prefix = sorted(prefix,reverse=True)
return(sort_prefix,rev_sort_prefix)
Explanation:
This defines the function
def compare_prefix(strX,strY):
This creates an empty set, prefix
prefix=set()
This iterates through each character in strX
for i in range(len(strX)):
This iterates through every other character in strX
for j in range(i+1,len(strX)):
This gets the prefix of strX by concatenating strings from i to j + 1
chk =strX[i:j+1]
This checks if the prefix is in strY
if chk in strY:
If yes, the string is added to set prefix
prefix.add(chk)
This sorts prefix
sort_prefix = sorted(prefix)
This reverses the sorted prefix
rev_sort_prefix = sorted(prefix,reverse=True)
This returns the sorted and reversed prefix
return(sort_prefix,rev_sort_prefix)
3.4 code practice question 2 edhesive
Which of the following is the cause of transmission impairment?
Select one:
O Frequency
O Amplitude
O Attenuation
O Phase
Answer:
attenuation is the third one
One way to add a table to a presentation is to click on Clip Art under the Insert tab. click on WordArt under the Insert tab. right-click on an existing page with content and choose Add Table. add a new slide and left-click on the Table symbol in an empty area.
Which of the following protocols help IP in multicast service?
Select one:
ORARP
O CMP
O ARP
O IGMP
Answer:
I guess IGMP.............
Answer:
IGMP
Explanation:
The correct answer is actually IGMP snooping.
so from your options it's IGMP
are you interested in cyber security?
a) Why is eavesdropping done in a network?
b) Solve the following using checksum and check the data at the
receiver:
01001101
00101000
Answer:
An eavesdropping attack is the theft of information from a smartphone or other device while the user is sending or receiving data over a network.
Missing: checksum 01001101 00101000
Fill in the blanks using A to J below.
1. ----- = command driven
2. ----- = general purpose
3. ----- = custom written
4. ----- = icon
5. ----- = menu driven
6. ----- = integrated software
7. ----- = desktop
8. ----- = system software
9. ----- = Window
10. ----- = software house
A. Software written to meet the specific needs of a company.
B. Related specialized programs combined in a unified package.
C. This software can be adapted for specific needs but is not written for any specific business purpose.
D. This interface requires the user to type in codes or words.
E. A pictorial representation of a file, folder, program, task or procedure.
F. This interface allows you to move a mouse or cursor to make a selection.
G. A rectangle that displays information on the screen.
H. A visual background over which all your work is done.
I. This software notifies the computer to begin sending data to the appropriate program to get a document printed.
J. A company that specializes in writing software.
Answer:
A.software written to meet specific needs of company
B.Related specialized programs combined in a unified package
How can presentation software be used in a
business or professional setting? Choose all that
apply.
to automate the ticket-purchasing process at
movie theaters through a kiosk
to teach lessons to high school students
to deliver a sales presentation to clients
to create charts and graphs from a table of
values
to compose letters and memos
DONE
Answer:
To automate the ticket purchasing process at the movie theaters through a kiosk
To teach lessons to high school students
To deliver a sales presentation to clients
Explanation:
I just used the answers above and got 2/3 wrong and edge said so
Which keyboard shortcut do we use to turn on APC?
Answer:
ctrl p I gusse hop it helps
bye know have a great day
Explanation:
Create a PetStore class, a Dog class, and Cat class. Once instantiated, a PetStore should be able to take in and give out pets. The store's method for receiving pets should be called receive. This method should take a single pet object (either a Dog or Cat instance) and should add it to the store's inventory of pets. The store's method for giving out a pet should be called sell and can take no arguments. The method returns a pet when called.
Answer:
thanks to the great place
Explanation:
hottest year in hindi history and happiness and the world is not a big deal to me because I think it's a good thing for a woman who has been a good friend of yours and happiness and be happy with examples
C++ coding, help
In this program you will be reading numbers from a file. You will validate the numbers and calculate the average of all of the valid numbers.
Your program will read in a file with numbers. The numbers will be of type double.
The numbers should be in the range from 0 to 110 (inclusive). You need to count all of the numbers between 0 and 110. You also need to calculate the average of these numbers.
If a number is not valid (that is, it is less than 0 or greater than 110) you need to count it (as a count of invalid values) and you need to write out the number to a file called "invalid-numbers.txt". Values written to file invalid-numbers.txt should be in fixed format with two digits to the right of the decimal point.
As you did in lab lesson 7 part 1 you need to read in the input file name using cin.
The output from your program will be written to cout. The output must contain the file being processed, the total number of values read in from the file, the number of invalid values read in, the number of valid values read in.
The last thing you need to output is either the average of the valid values or an error message. The average must have two digits of precision to the right of the decimal point and must be in fixed format. If there is not valid average you should output the message:
An average cannot be calculated
In what case would you display this message?
If the input file cannot be opened, you will need to output a message. Assume the input file name is badinput.txt and it cannot be opened. You will display the following error message to cout
File "badinput.txt" could not be opened
Here is an example of a working program:
Assume the file name read in from cin is:
input.txt
and that input.txt contains:
-12
0
98.5
100
105.5
93.5
88
75
-3
111
89
-12
Your program would output the following:
Reading from file "input.txt"
Total values: 12
Invalid values: 4
Valid values: 8
Average of valid values: 81.19
The contents written out to file invalid-numbers.txt are:
-12
-3
111
-12
You are reading from an input file and you are writing to an output file. Make sure you close both files after you are finished using them. You must do this in your program, you cannot just let the operating system close the files for you.
For tests where there is output written to an output file the contents of the output file will determine if you passed that test or not. For cases where you have written out to cout the tests will check the output sent to cout. In some cases output will be written to a file and to cout. When this is the case the test will be run twice with the same input. Once to test cout and once to test the contents of the output file. An example of this would be tests 2 and 3. Both use the same input file. Test 2 check the output written to cout and test 3 checks the output written to the file invalid-numbers.txt.
Answer:
The program in C++ is as follows:
#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
string filename;
cout<<"Filename: ";
cin>>filename;
ifstream inFile(filename);
if(!inFile) {
cout << endl << "Cannot open file " << filename;
return 1; }
ofstream fout;
ifstream fin;
fin.open("invalid-numbers.txt");
fout.open ("invalid-numbers.txt",ios::app);
double sum = 0; int valid = 0; int invalid = 0;
double num = 0;
while(!inFile.eof()) {
inFile >> num;
if(num >= 0 && num<=110){ sum+=num; valid++; }
else{ invalid++;
if(fin.is_open()){
fout<<fixed<<setprecision(2)<<num<<"\n"; } } }
fin.close();
fout.close();
inFile.close();
cout<<"Total values: "<<valid+invalid<<endl;
cout<<"Invalid values: "<<invalid<<endl;
cout<<"Valid values: "<<valid<<endl;
cout<<"Average of valid values: "<<fixed<<setprecision(2)<<sum/valid<<endl;
double inv;
ifstream inFiles("invalid-numbers.txt");
while(!inFiles.eof()) {
inFiles >> inv;
cout<<inv<<"\n";
}
inFiles.close();
return 0;
}
Explanation:
See attachment for source file where comments are used to explain each line
Create a class named TriviaGameV1 that plays a simple trivia game. The game should have five questions. Each question has a corresponding answer and point value between 1 and 3 based on the difficulty of the question. TriviaGameV1 will use three arrays. An array of type String should be used for the questions. Another array of type String should be used to store the answers. An array of type int should be used for the point values. All three arrays should be declared to be of size 5. The index into the three arrays can be used to tie the question, answer, and point value together. For example, the item at index 0 for each array would correspond to question 1, answer 1, and the point value for question 1. Manually hardcode the five questions, answers, and point values in the constructor of TriviaGameV1. The five questions and their corresponding answers are shown on page 3. The point values should be set to 1, 2, 2, 3, 1, respectively.
The class should also provide the following two public methods:
• public boolean askNextQuestion() - This method takes no argument and returns a boolean. If there are no more questions to ask, it returns false. Otherwise, it asks the next question and gets an answer from the user. If the player’s answer matches the actual answer (case insensitive comparison), the player wins the number of points for that question. If the player’s answer is incorrect, the player wins no points for the question and the method will show the correct answer. It returns true after Q & A have been processed.
• public void showScore() - This method takes no argument and returns void. It displays the current score the player receives thus far.
The test driver is provided below, which creates a TriviaGameV1 object. After the player has answered all five questions, the game is over.
public class TriviaGameV1Test {
public static void main(String[] args) { TriviaGameV1 game = new TriviaGameV1();
while (game.askNextQuestion()) game.showScore(); System.out.println("Game over! Thanks for playing!"); }
}
Answer:
Explanation:
The following code is written in Java, It creates the class for the Trivia game along with the arrays, variables, and methods as requested so that it works flawlessly with the provided main method/test driver. The attached picture shows the output of the code.
import java.util.Arrays;
import java.util.Scanner;
class TriviaGameV1 {
String[] questions = {"The first Pokemon that Ash receives from Professor Oak is?", "Erling Kagge skiied into here alone on January 7, 1993", "1997 British band that produced 'Tub Thumper'", "Who is the tallest person on record (8 ft. 11 in) that has lived?", "PT Barnum said \"This way to the _______\" to attract people to the exit."};
String[] answers = {"pikachu", "south pole", "chumbawumba", "robert wadlow", "egress"};
int[] points = { 1, 2, 2, 3, 1};
int score;
int count = 0;
public void TriviaGameV1() {
this.score = 0;
}
public boolean askNextQuestion() {
if (count != 5) {
Scanner in = new Scanner(System.in);
System.out.println(questions[count]);
String answer = in.nextLine().toLowerCase();
if (answer.equals(answers[count])) {
score += points[count];
} else {
System.out.println("Wrong, the correct answer is : " + answers[count]);
}
count += 1;
return true;
}
return false;
}
public void showScore() {
System.out.println("Your Score is: " + this.score);
}
public static void main(String[] args) {
TriviaGameV1 game = new TriviaGameV1();
while (game.askNextQuestion()) {
game.showScore();
}
System.out.println("Game over! Thanks for playing!");
}
}
Which of the following is the cause of transmission impairment?
Select one:
O Frequency
O Amplitude
O Attenuation
O Phase
Answer:
Attenuation is the cause of transmission impairment.hope it is helpful to you
Select the best ansiver for each question below
c. Linux
c. operational interference
2. What type of software works with users, application software, and computer hardware
handle the majority of technical details?
a Application
b. Desktop
d. system
The ability to switch between different applications stored in memory is called
a Diversion
b. Multitasking
d. programming
Graphic representations for a program, type of file, ar function:
a. App
e image
b. Icon
d. software
The operating system based on Linux, designed for Netbook computers, and focused on
Internet connectivity through cloud computing:
a Chrome
c. Unix
b. Mac
d. Windows
Programs that coordinate computer resources, provide an interface, and run applicatio
Answer:
the answer is going to be system
Write a program that lets the user perform arithmetic operations on fractions. Fractions are of the form a/b, in which a and b are integers and b is not equal to 0. Your program must be menu driven, allowing the user to select the operation ( , -, *, or /) and input the numerator and the denominator of each fraction. Furthermore, your program must consist of at least the following function
menu: This function informs the user about the program's purpose, explains how to enter data, how to quit and allows the user to select the operation.
addFractions: This function takes as input four integers representing the numerators and denominators of two fractions, adds the fractions, and returns the numerator and denominator of the result.
subtractFractions: This function takes as input four integers representing the numerators and denominators of two fractions, subtracts the fractions, and returns the numerator and denominator of the result.
multiplyFractions: This function takes as input four integers representing the numerators and denominators of two fractions, multiplies the fractions, and returns the numerator and denominator of the result.
divideFractions: This function takes as input four integers representing the numerators and denominators of two fractions, divides the fractions, and returns the numerator and denominator of the result.
Here are some sample outputs of the program:
3 / 4 +2 / 5 = 23 / 20
2 / 3 * 3 / 5 = 2 / 5
Answer:
Explanation:
The following code is written in Java, It asks the user to enter the numerator and denominator for both fraction 1 and 2. Then it prompts the user with a menu to choose the desired operation. The choice is passed into a switch statement and calls the correct function.
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int num1, num2, den1, den2;
System.out.println("Enter numerator for fraction 1: ");
num1 = in.nextInt();
System.out.println("Enter denominator for fraction 1: ");
den1 = in.nextInt();
System.out.println("Enter numerator for fraction 2: ");
num2 = in.nextInt();
System.out.println("Enter denominator for fraction 2: ");
den2 = in.nextInt();
System.out.println("Menu:");
System.out.println("+ = add fractions");
System.out.println("- = subtract fractions");
System.out.println("/ = divide fractions");
System.out.println("* = multiply fractions");
String answer = in.next();
switch (answer.charAt(0)) {
case '+': add(num1, den1, num2, den2); break;
case '-': subtract(num1, den1, num2, den2); break;
case '*': multiply(num1, den1, num2, den2); break;
case '/': divide(num1, den1, num2, den2); break;
}
}
public static void add(int num1, int den1, int num2, int den2) {
int num3 = (num1 * den2) + (num2 * den1);
int den3 = den1 * den2;
System.out.println("New Fraction: " + num3 + " / " + den3);
}
public static void subtract(int num1, int den1, int num2, int den2) {
int num3 = (num1 * den2) - (num2 * den1);
int den3 = den1 * den2;
System.out.println("New Fraction: " + num3 + " / " + den3);
}
public static void divide(int num1, int den1, int num2, int den2) {
int num3 = num1 * den2;
int den3 = den1 * num2;
System.out.println("New Fraction: " + num3 + " / " + den3);
}
public static void multiply(int num1, int den1, int num2, int den2) {
int num3 = num1 * num2;
int den3 = den1 * den2;
System.out.println("New Fraction: " + num3 + " / " + den3);
}
}
The L-exclusion problem is a variant of the starvation-free mutual exclusion problem. We make two changes: as many as L threads may be in the critical section at the same time, and fewer than L threads might fail (by halting) in the critical section. An implementation must satisfy the following conditions:_____.
L-Exclusion: At any time, at most L threads are in the critical section.
L-Starvation-Freedom: As long as fewer than L threads are in the critical section, then some thread that wants to enter the critical section will eventually succeed (even if some threads in the critical section have halted).
Modify the n-process Bakery mutual exclusion algorithm to turn it into an L-exclusion algorithm. Do not consider atomic operations in your answer. You can provide a pseudo-code solution or written solution.
Answer:
The solution is as follows.
class LFilters implements Lock {
int[] lvl;
int[] vic;
public LFilters(int n, int l) {
lvl = new int[max(n-l+1,0)];
vic = new int[max(n-l+1,0)];
for (int i = 0; i < n-l+1; i++) {
lvl[i] = 0;
}
}
public void lock() {
int me = ThreadID.get();
for (int i = 1; i < n-l+1; i++) { // attempt level i
lvl[me] = i;
vic[i] = me;
// rotate while conflicts exist
int above = l+1;
while (above > l && vic[i] == me) {
above = 0;
for (int k = 0; k < n; k++) {
if (lvl[k] >= i) above++;
}
}
}
}
public void unlock() {
int me = ThreadID.get();
lvl[me] = 0;
}
}
Explanation:
The code is presented above in which the a class is formed which has two variables, lvl and vic. It performs the operation of lock as indicated above.
what is the best plugin for subscription sites?
Answer:
Explanation:
MemberPress. MemberPress is a popular & well-supported membership plugin. ...
Restrict Content Pro. ...
Paid Memberships Pro. ...
Paid Member Subscriptions. ...
MemberMouse. ...
iThemes Exchange Membership Add-on. ...
Magic Members. ...
s2Member.
I have some true or false questions I need help with. 9th grade.**
Handware can be tracked back to ancient times. Over six centuries ago.
True or false.
Hardware is only found in computers.
True or false. I know
Instruments and weaving looms where some of the first pieces of hardware.
True or false.
Computers and hardware is the same thing
True or false.
Answer:
Hardware can be traced back to ancient times. False
Hardware is only found in computers. False
Instruments and weaving looms were some of the first pieces of hardware. False
Computers and hardware is the same thing. This question is a bit broad but there's many different types of hardware. From keyboards to printers to speakers.
I tried my best not exactly sure though.
LAB: Contact list 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. Assume that the list will always contain less than 20 word pairs. Ex: If the input is: 3 Joe 123-5432 Linda 983-4123 Frank 867-5309 Frank the output is: 867-5309
Answer:
The program in Python is as follows:
n = int(input(""))
numList = []
for i in range(n):
word_pair = input("")
numList.append(word_pair)
name = input("")
for i in range(n):
if name.lower() in numList[i].lower():
phone = numList[i].split(" ")
print(phone[1])
Explanation:
This gets the number of the list, n
n = int(input(""))
This initializes list
numList = []
This iterates through n
for i in range(n):
This gets each word pair
word_pair = input("")
This appends each word pair to the list
numList.append(word_pair)
This gets a name to search from the user
name = input("")
This iterates through n
for i in range(n):
If the name exists in the list
if name.lower() in numList[i].lower():
This gets the phone number associated to that name
phone = numList[i].split(" ")
This prints the phone number
print(phone[1])
What is needed to broadcast a presentation on the internet using PowerPoint’s online service?
Answer:
a Microsoft account
Explanation:
Answer:
Its B
a Microsoft account
Explanation:
A new school is being built in the local school district. It will have three computer labs with 28 computers each. There will be 58 classrooms with 2 computers each that need to be on one sub-subnet. The office staff and administrators will need 7 computers. The guidance and attendance office will have 5 computers. The school has been given the address 223.145.75.0/24.
Complete the information required below.
Subnet Subnet Mask (/X) Subnet Address First Usable Host Last Usable Host Broadcast Address
1
2
3
4
5
6
7
8
9
10
Answer:
The table is formed as attached figure.
Explanation:
Subnets can use specific number of hosts so /25 can host 128 hosts, reducing by a factor of 2 leading to /30 as with only 4 hosts. Thus the subnets are alloted as indicated in the attached image.
For the recursive method below, list the base case and the recursive statement, then show your work for solving a call to the recur() method using any parameter value 10 or greater.
public static int recur(int n)
{
if(n < 1)
{
return 3;
}
else
{
return recur(n / 5) + 2;
}
}
Answer:
(a): The base case: if(n<1)
(b): The recursive statement: recur(n / 5)
(c): Parameter 10 returns 7
Explanation:
Given
The above code segment
Solving (a): The base case:
The base case is that, which is used to stop the recursion. i.e. when the condition of the base case is true, the function is stopped.
In the given code, the base case is:
if(n<1)
Solving (b): The recursive statement:
The recursive statement is the statement within the function which calls the function.
In the given code, the recursive statement is:
recur(n / 5)
Solving (c): A call to recur() using 10
The base case is first tested
if (n < 1); This is false because 10 > 1
So, the recursive statement is executed
recur(n/5) +2=> recur(10/5)+2 => recur(2)+2
2 is passed to the function, and it returns 2
if (n < 1); This is false because 2 > 1
So, the recursive statement is executed
recur(n/5) +2=> recur(2/5)+2 => recur(0)+2
2 is passed to the function, and it returns 2
if (n < 1); This is true because 0 < 1
This returns 3
So, the following sum is returned
Returned values = 2 + 2 + 3
Returned values = 7
A line beginning with a # will be transmitted to the programmer’s social media feed.
A.
True
B.
False
Answer:
True?
Explanation:
Answer:
The answer is false.
Explanation:
A “#” doesn’t do that in Python.
Can someone plz answer these questions
Answer:
11001100 = 204
11111111 = 255
Explanation:
For 11001100:
1*2⁷ + 1*2⁶ + 0*2⁵ + 0*2⁴ + 1*2³ + 1*2² + 0*2¹ + 0*2⁰ = 204
Just replace 1's by 0's in the following calculation to do it for every 8 bit number:
1*2⁷ + 1*2⁶ + 1*2⁵ + 1*2⁴ + 1*2³ + 1*2² + 1*2¹ + 1*2⁰ = 255
If you don't want to do the calculation yourself, you can set the windows calculator in programmer mode, then select binary and key in the number.
Economic Batch Quantity depends on
دی ماه
Material, labour
Set-up costs, carrying
Transportation, carrying
Warehousing, labour
Answer: Set-up costs, carrying costs
Explanation:
When it comes to production, the goal is to produce with as little costs as possible so that more profit can be made when the goods are sold.
This is why the Economic Batch Quantity is important. It shows the maximum amount of goods that can be produced in a particular production run such that costs will be minimized.
As such, it is based on the set-up costs of production for that run as well as the carrying costs through the run.