Answer:
In python, the statement can be written as:
if(special_num in special_list): print("Special Number")
Explanation:
We need to create a list with the name 'special_list' with some values and then check whether special_num is in the list or not using the membership operator.
Membership operator in python: in
Let us do it step by step in python:
special_list = ['1', '2', '3','4'] #A list with the values 1, 2, 3 and 4
special_num = input("Enter the number to be checked as special \t")
#Taking the input from the user in the variable special_num.
if(special_num in special_list): print("Special Number")
#Using the membership operator in to check whether it exists in the list or not.
Please refer to the image attached for the execution of above program.
So, the answer is:
In python, the statement can be written as:
if(special_num in special_list): print("Special Number")
Create a program that will find and display the largest of a list of positive numbers entered by the user. The user should indicate that he/she has finished entering numbers by entering a 0.
Answer:
This program is written using Python Programming language,
The program doesn't make use of comments (See explanation section for line by line explanation)
Program starts here
print("Enter elements into the list. Enter 0 to stop")
newlist = []
b = float(input("User Input: "))
while not b==0:
newlist.append(b)
b = float(input("User Input: "))
newlist.sort()
print("Largest element is:", newlist[-1])
Explanation:
This line gives the user instruction on how to populate the list and how to stop
print("Enter elements into the list. Enter 0 to stop")
This line creates an empty list
newlist = []
This line enables the user to input numbers; float datatype was used to accommodate decimal numbers
b = float(input("User Input: "))
The italicized gets input from the user until s/he enters 0
while not b==0:
newlist.append(b)
b = int(input("User Input: "))
This line sorts the list in ascending order
newlist.sort()
The last element of the sorted list which is the largest element is printed using the next line
print("Largest element is:", newlist[-1])
Write a program that first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of words separated by commas. Your program should output the words and their frequencies (the number of times each word appears in the file) without any duplicates.
Answer:
Here is the Python code.
import csv
inputfile = input("Enter name of the file: ")
count = {}
with open(inputfile, 'r') as csvfile:
csvfile = csv.reader(csvfile)
for line in csvfile:
for words in line:
if words not in count.keys():
count[words] = 1
else:
count[words] + 1
print(count)
Explanation:
I will explain the code line by line.
import csv here the css is imported in order to read the file using csv.reader() method
inputfile = input("Enter name of the file: ") This statement takes the name of the input file from the user
count = {} this is basically a dictionary which will store the words in the file and the number of times each word appears in the file.
with open(inputfile, 'r') as csvfile: This statement opens the inputfile using open() method in read mode. This basically opens the input file as csv type
csvfile = csv.reader(csvfile) This statement uses csv.reader() method to read the csv file contents.
for line in csvfile: This outer for loop iterates through each line of the file
for words in line: This inner loop iterates through each word in the line
if words not in count.keys(): This if condition checks if the word is not in the dictionary already. The dictionary holds key value pair and keys() method returns a list of all the keys of dictionary
count[words] = 1 if the word is not present already then assign 1 to the count dictionary
co unt[words] + 1 if the word is already present in dictionary increment count of the words by 1. Suppose the input file contains the following words:
hello,cat,man,hey,dog,boy,Hello,man,cat,woman,dog,Cat,hey,boy
Then because of co unt[words] + 1 statement if the word appears more than once in the file, then it will not be counted. So the output will be:
{' cat': 1, ' man': 1, ' dog': 1, ' woman': 1, ' Hello': 1, ' hey': 1, ' boy': 1, 'hello': 1, ' Cat': 1}
But if you want the program to count those words also in the file that appear more than once, then change this co unt[words] + 1 statement to:
count[words] = count[words] + 1
So if the word is already present in the file its frequency is increased by 1 by incrementing 1 to the count[words]. This will produce the following output:
{' Cat': 1, ' cat': 2, ' boy': 2, ' woman': 1, ' dog': 2, ' hey': 2, ' man': 2, ' Hello': 1, 'hello': 1}
You can see that cat, boy, dog and hey appear twice in the file.
print(count) This statement prints the dictionary contents with words and their frequencies.
The program with its output is attached.
The program is an illustration of file manipulations.
File manipulations involve reading from and writing into files.
The program in Python, where comments are used to explain each line is as follows:
#This imports csv module
import csv
#This initializes a dictionary
kounter = {}
#This gets input for the file name
fname = input("Filename: ")
#This opens and iterates through the file
with open(fname, 'r') as cfile:
#This reads the csv file
cfile = csv.reader(cfile)
#This iterates through each line
for line in cfile:
#This iterates through each word on each line
for words in line:
#This counts the occurrence of each word
if words not in kounter.keys():
kounter[words] = 1
else:
kounter[words] + 1
#This prints the occurrence of each word
print(kounter)
Read more about similar programs at:
https://brainly.com/question/14468239
Which operating system problem might cause the desktop background to change
unexpectedly? Choose the answer.
A boot failure
B startup loop
C malware D incompatibility
It should be noted that the operating system problem that might cause the desktop background to change is D incompatibility.
What is operating system problem?The operating system problem serves as those error that can affect the operation of the operating system in computer.
This System errors are caused by malfunctioning hardware components as well as corrupted operating system modules and one of this is compatibility.
Learn more about operating system problem at;
https://brainly.com/question/17506968
The following code uses a nested if statement.
if (employed == 'Y')
cout << "Employed!" << endl;
else if (employed == 'N')
cout << "Not Employed!" << endl;
else
cout << "Error!" << endl;
a. True
b. False
Answer:
true
Explanation:
else if used so I think it's true
Define stubs for the functions get_user_num) and compute_avg). Each stub should print "FIXME: Finish function_name" followed by a newline, and should return -1. Each stub must also contain the function's parameters Sample output with two calls to get_user_num) and one call to compute_avg): FIXME: Finish get_user_num() FIXME: Finish get_user_num() FIXME: Finish compute_avg() Avg: -1 1 ' Your solution goes here '' 2 4 user_num1 = 0 5 user_num2 = 0 6 avg_result = 0 7 8 user_num1 = get_user_num 9 user_num2 = get_user_num ) 10 avg_result = compute_avg(user_num1, user_num2) 11 12 print'Avg:', avg_result)|
Answer:
Here are the stub functions get_user_num() and compute_avg()
def get_user_num():
print('FIXME: Finish get_user_num()')
return -1
def compute_avg(user_num1, user_num2):
print('FIXME: Finish compute_avg()')
return -1
Explanation:
A stub is a small function or a piece of code which is sometimes used in program to test a function before its fully implemented. It can also be used for a longer program that is to be loaded later. It is also used for a long function or program that is remotely located. It is used to test or simulate the functionality of the program.
The first stub for the function get_user_num() displays FIXME: Finish get_user_num() and then it returns -1.
The seconds stub for the function compute_avg() displays the FIXME: Finish compute_avg() and then it returns -1.
Here with each print statement, there is function name after this FIXME: Finish line. The first function name is get_user_num and the second is compute_avg().
Next the function get_user_num() is called twice and function compute_avg() followed by a print statement: print('Avg:', avg_result) which prints the result. So the program as a whole is given below:
def get_user_num():
print('FIXME: Finish get_user_num()')
return -1
def compute_avg(user_num1, user_num2):
print('FIXME: Finish compute_avg()')
return -1
user_num1 = 0 # the variables are initialized to 0
user_num2 = 0
avg_result = 0
user_num1 = get_user_num() #calls get_user_num method
user_num2 = get_user_num()
avg_result = compute_avg(user_num1, user_num2)
print('Avg:', avg_result)
The method get_user_num() is called twice so the line FIXME: Finish get_user_num() is printed twice on the output screen. The method compute_avg() is called once in this statement avg_result = compute_avg(user_num1, user_num2) so the line FIXME: Finish compute_avg() is printed once on the output screen. Next the statement print('Avg:', avg_result) displays Avg: -1. You can see in the above program that avg_result = compute_avg(user_num1, user_num2) and compute_avg function returns -1 so Avg= -1. The program along with the produced outcome is attached.
Identify and write the errors given in the flowchart (with steps and flowchart) : Start ↓ Input A,B ↓ Average = (A + B + C) / 3 ↓ Print Average ↓ Stop
Answer:
i will send you the answers in the next 10minute
Write a program that asks the user to input a positive integer and then calculates and displays the factorial of the number. The program should call a function named getN
Answer:
The program is written in python and it doesn't make use of any comment;
(See explanation section for line by line explanation)
def getN(num):
fact = 1
for i in range(1, 1 + num):
fact = fact * i
print("Factorial: ",fact)
num = int(input("Number: "))
if num < 0:
print("Invalid")
else:
getN(num)
Explanation:
The function getNum is defined here
def getN(num):
Initialize the result of the factorial to 1
fact = 1
Get an iteration from 1 to the user input number
for i in range(1, 1 + num):
Multiply each number that makes the iteration
fact = fact * i
Print result
print("Factorial: ",fact)
Ths line prompts user to input number
num = int(input("Number: "))
This line checks if user input is less than 0; If yes, the program prints "Invalid"
if num < 0:
print("Invalid")
If otherwise, the program calls the getN function
else:
getN(num)
In cell B13, create a formula using the VLOOKUP function that looks up the value from cell A11 in the range A5:B7, returns the value in column 2, and specifies an exact match.
Answer:
VLOOKUP(A11,A5:B7,2,0) is the correct answer to this question.
Explanation:
The VLOOKUP method contains a vertical lookup by scouring for worth in a table's first section and trying to return the significance in the throughout the situation within the same row. The VLOOKUP excel is a built-in function classified as a Lookup / see as.
According to the question:-
The formulation needed to enter is = VLOOKUP(A11, A5: B7,2,0)
The first "A11" here is the cell from which value is retrieved
The second "A5: B7" input is the range for the table where you need to lookup. 2 Is the number of the column from which the value is taken and 0 indicates the exact math
The VLOOKUP function is used to look up a value in a particular column.
The VLOOKUP formula to enter in cell B13 is: VLOOKUP(A11,A5:B7,2,0)
The syntax of a VLOOKUP function is:
VLOOKUP(lookup_value, cell_range, column_index, [return_value])
Where:
lookup_value represents the value to look upcell_range represents the cells to checkcolumn_index represents the column index[return_value] is an optional entry, and it represents the value that will be returned by the look up function.From the question, we have:
lookup_value = cell A11cell_range = cell A5 to B7column_index = 2[return_value] = 0So, the VLOOKUP function would be: VLOOKUP(A11,A5:B7,2,0)
Read more about VLOOKUP function at:
https://brainly.com/question/19372969
If your computer freezes on a regular basis and you checked your hard drive and you have insufficient space you've not installed any software that could cause disruption you have recently added more around so you realize that you have enough memory and that isn't causing a problem what could you do to check next? A) Ensure that the computer is disconnected from the internet by removing any Ethernet cables. B) Use scandisk to ensure that the hard drive is not developing errors or bad sectors. C) Replace the CPU and RAM right away. D) Install additional fans to cool the motherboard.
Answer:
d
Explanation:
If your computer freezes on a regular basis, and you have enough memory and that isn't causing a problem. You should install additional fans to cool the motherboard. The correct option is D.
What is computer freezing?Computer freezing means the computer is not running smoothly. It is causing concerns in opening any application or running software. It is also called computer hanging. The freezing can occur due to the heating of the motherboard. The addition of the fans would be good.
Freezing on the computer happens when the memories of the computer are full, or any virus has been installed on the computer. Hanging or freezing of computers can be avoided by emptying some data or installing an antivirus.
Thus, the correct option is D. Install additional fans to cool the motherboard.
To learn more about computer freezing, refer to the link:
https://brainly.com/question/15085423
#SPJ2
what kind of company would hire an information support and service employee?
-software development
-computer repair
-website development
-network administration
Answer:
it's a
Explanation:
When introducing new devices to the network, the organization's security policy requires that devices be monitored to establish normal traffic patterns for the device. Which of the following is generated from initial monitoring?
A. SLA
B. Baseline
C. Forensic log
D. Vulnerability assessment
Answer:
The answer is "Option B".
Explanation:
The Baseline measurement is an essential characteristic of effective coal company monitoring programs to assess the degree of mining effects and keep on improving effect monitoring the system will continue to be modified via periodical analyses, and the wrong choices can be defined as follows:
In choice A, it is wrong because it used in 3D printing technology. In choice C, it is used to analyze the log entities, that's why it is wrong. In choice D, it is used to analyze the security weaknesses, that's why it's wrong.any element that has a starting tag and does not have a closing tag is called a ?
pls be quick guys
Answer:
Any element that has a starting tag and doesn't have a closing tag is called a empty element.
:)
If no other row matches, the router will select the ________ row as its best match. First Last either First or Last, depending on the circumstances neither First nor Last
Answer:
Last
Explanation:
Routing is a term in engineering which involves the process of selecting a path for traffic in a network or across multiple networks. It is applicable in circuit-switched networks, such as the public switched telephone network (PSTN), and computer networks, such as the Internet. It is mostly used as a term for IP Routing.
Hence, in IP Routing, the first step is comparing the packet's destination IP address to all rows, followed by selecting the nest-match row. However, If no other row matches, the router will select the LAST row as its best match.
Suppose that a main method encounters the statement t3.join(); Suppose that thread t3's run() method has completed running. What happens?
A. The main method waits for all running threads to complete their run() methods before proceeding.
B. The main method waits for any other thread to complete its run() method before proceeding
C. The main method proceeds to the next statement following the t3.join(); statement
D. Thread t 3 is re-started
E. All threads except t3 that are running are terminated
Answer:
C. The main method proceeds to the next statement following the t3.join(); statement
Explanation:
join() method allows the thread to wait for another thread and completes its execution. If the thread object is executing, then t3.join() will make that t is terminated before the program executes the instruction. Thread provides the method which allows one thread to another complete its execution. If t is a thread object then t.join() will make that t is terminated before the next instruction. There are three overloaded functions.
join()
join(long mills)
join(long millis, int Nanos)
If multiple threads call the join() methods, then overloading allows the programmer to specify the period. Join is dependent on the OS and will wait .
Assume that to_the_power_of is a function that expects two integer parameters and returns the value of the first parameter raised to the power of the second parameter. Write a statement that calls to_the_power_of to compute the value of cube_side raised to the power of 3 and that associates this value with cube_volume.
Answer:
The statement in python is as follows:
to_the_power_of(cube_side,3)
Explanation:
As stated as the requirement of the code segment, the statement takes as parameters a variable cube_side and a constant 3.
It then returns the volume of the cube; i.e. cube raise to power 3
See full program below
def to_the_power_of(val,powe):
result = val**powe
print(result)
cube_side = float(input("Cube side: "))
to_the_power_of(cube_side,3)
Select the option that is not true. 1. Timestamp and Validation schedulers are both optimistic schedulers. 2. Timestamp and Validation schedulers can be used to remove physically unrealizable behaviour. 3. Timestamp and Validation schedulers guarantee serializability. 4. Timestamp and Validation schedulers perform most effectively on transactions that perform writes.
Answer:
3. Timestamp and Validation schedulers guarantee serializability.
Explanation:
Timestamp is a sequence of information encoded when a certain event occurs at a given time that information is decoded and message is identified. Time schedulers is optimistic scheduler and it removes physically unrealizable behavior. Timestamp cannot guarantee serializability. It can detect unrealizable behavior.
Write the definition of the function displaySubMenu that displays the following menu; this function doesn't collect the user's input; only display the following menu:
[S]top – Press 'S' to stop.
Answer:
Using Python:
def displaySubMenu():
print("[S]top – Press ‘S’ to stop.")
Using C++ programming language:
void displaySubMenu(){
cout<<"[S]top – Press ‘S’ to stop.";}
Explanation:
The function displaySubMenu() has a print statement that prints the following message when this function is called:
[S]top – Press 'S' to stop.
You can invoke this function simply by calling this function as:
displaySubMenu()
The function doesn't take any input from the user and just displays this message on output screen whenever this function is called.
In C++ you can simply call the function using following statement:
void main(){
displaySubMenu(); }
Write a date transformer program using an if/elif/else statement to transform a numeric date in month/day format to an expanded US English form and an international Spanish form; for example, 2/14 would be converted to February 14 and 14 febrero
I wrote it in Python because it was quick so i hope this is helpful
Answer:
date = input('Enter Date: ')
split_date = date.split('/')
month = split_date[0]
day = split_date[1]
if month == '1':
english_month = 'January'
spanish_month = 'Enero'
elif month == '2':
english_month = 'February'
spanish_month = 'Febrero'
elif month == '3':
english_month = 'March'
spanish_month = 'Marzo'
elif month == '4':
english_month = 'April'
spanish_month = 'Abril'
elif month == '5':
english_month = 'May'
spanish_month = 'Mayo'
elif month == '6':
english_month = 'June'
spanish_month = 'Junio'
elif month == '7':
english_month = 'July'
spanish_month = 'Julio'
elif month == '8':
english_month = 'August'
spanish_month = 'Agosto'
elif month == '9':
english_month = 'September'
spanish_month = 'Septiembre'
elif month == '10':
english_month = 'October'
spanish_month = 'Octubre'
elif month == '11':
english_month = 'November'
spanish_month = 'Noviembre'
elif month == '12':
english_month = 'December'
spanish_month = 'Diciembre'
US_English = f'{english_month} {day}'
International_Spanish = f'{day} {spanish_month}'
print(f'US English Form: {US_English}')
print(f'International Spanish Form: {International_Spanish}')
Input:
3/5
Output:
US English Form: March 5
International Spanish Form: 5 Marzo
Explanation:
You start by taking input from the user then splitting that at the '/' so that we have the date and the month in separate variables. Then we have an if statement checking to see what month is given and when the month is detected it sets a Spanish variable and an English variable then prints it to the screen.
Hope this helps.
11. Which one of the following buttons is used for paragraph alignment?
Answer:
C
Explanation:
Option A is used for line spacing.
Option B is used for right indent.
Option C is used for right paragraph alignment.
Option D is used for bullet points.
The button used for paragraph alignment would be option C.
How does computer mouse impact the world, society and health?
Explanation:
Without it, we may have endured convoluted keyboard commands for years, greatly hindering the process of bringing the PC into homes everywhere. The mouse revolutionized computer interfaces, simplified an otherwise scary machine, and helped connect the world.
21. The quality of worth or merit, excellence and importance; custom or
ideal that people desire as an end, often shared within a group.
*
Answer:
Goals
Explanation:
Interestingly, the term goals refers to a perceived future a certain individual or group of individuals are hopeful for, or better still it could be an expectation of improved quality of worth or merit, excellence and importance; custom or ideals that people desire as an end, often shared within a group.
Remember, goals are desired end, achieved as a result of deliberate action or actions towards attaining it.
In the Programming Process which of the following is not involved in defining what the program is to do:_____________ Group of answer choices
a. Compile code
b. Purpose
c. Output
d. Input
e. Process
Answer:
a. Compile code
Explanation:
In programming process, the following are important in defining what a program is to do;
i. Purpose: The first step in writing a program is describing the purpose of the program. This includes the aim, objective and the scope of the program. The purpose of a program should be defined in the program.
ii. Input: It is also important to specify inputs for your program. Inputs are basically data supplied to the program in order to perform a task. Valid inputs are defined in the program.
iii. Output: Many times, when inputs are supplied to a program the resulting effects are shown in the outputs. The way the output will be is defined in the program.
iv. Process: This involves the method by which inputs are being mapped into outputs. The process implements the functionality of the program by converting inputs into their corresponding outputs. The process is defined in the program.
Compile code is not a requirement in defining what a program is to do. It just allows the source code of the program to be converted into a language that the machine understands.
The CPU control unit is responsible for A. obtaining instructions B. interpreting instructions C. all logic functions D. both A and B
Answer:
D. Both A and B
Explanation:
Because it controls the input and output of data, check the signals have been delivered successfully, and make sure that data goes to the correct place at the correct time.
Explain what a honeypot is. In your explanation, give at least one advantage and one disadvantage of deploying a honeypot on a corporate network.
Answer:
A honeypot is a computer network set up to act as a decoy to track, deflect, or research trying to obtain unwanted access to the information system.
Explanation:
A honeypot is a device or device network designed to imitate possible cyber-attack targets. It can be utilized to detect or deflect assaults from a legitimate military target. It may also be used to collect knowledge on how cybercrime works.
Advantage:-
Data Value:- One of the challenges faced by the research community is to obtain meaning from big data. Companies hold large quantities of data daily including firewall logs, device logs, and warnings for vulnerability scanning. Resources:- The problem facing most protection systems is resource shortages or even the depletion of resources. Power saturation is when a protection asset can no longer work since it is overloaded by its assets. Simplicity :- I find simplicity to be the biggest single strength of honeypots. No flashy techniques are to be created, no stamp computer systems to be managed, no rule units to be misconfigured.Disadvantage:-
That honeypot doesn't replace any safety mechanisms; they just operate with your overall security infrastructure and improve it.
A variable like userNum can store a value like an integer. Extend the given program to print userNum values as indicated.
(1) Output the user's input. Enter integer: 4 You entered: 4
(2) Extend to output the input squared and cubed. Enter integer: 4 You entered: 4 4 squared is 16 And 4 cubed is 64!!
(3) Extend to get a second user input into userNum2. Output sum and product. Enter integer: 4 You entered: 4 4 squared is 16 And 4 cubed is 64!! Enter another integer: 5 4+5 is 9 4*5 is 20.
Answer:
This program is written using Java programming language.
No comments were used; however, see explanation section for line by line explanation
import java.util.*;
public class Nums {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
System.out.println("1.");
int userNum;
System.out.print("Enter Integer: ");
userNum = input.nextInt();
System.out.println("You entered: "+userNum);
System.out.println("2.");
System.out.print("Enter Integer: ");
userNum = input.nextInt();
System.out.println("You entered: "+userNum);
System.out.println(userNum+" squared is "+(userNum * userNum));
System.out.println("And "+userNum+" cubed is "+(userNum * userNum * userNum)+"!!");
System.out.println("3.");
System.out.print("Enter Another integer: ");
int userNum2 = input.nextInt();
System.out.println(userNum+" + "+userNum2+" is "+(userNum + userNum2));
System.out.println(userNum+" * "+userNum2+" is "+(userNum * userNum2));
}
}
Explanation:
This enables the program accept inputs
Scanner input = new Scanner(System.in);
This signifies the beginning of number 1
System.out.println("1.");
Variable userNum is declared as type integer
int userNum;
The line prompts the user for input
System.out.print("Enter Integer: ");
The line accepts the input
userNum = input.nextInt();
This line displays user input
System.out.println("You entered: "+userNum);
This signifies the beginning of number 2
System.out.println("2.");
This line prompts the user for input
System.out.print("Enter Integer: ");
This line accepts input
userNum = input.nextInt();
This line prints user input (as required in number 2)
System.out.println("You entered: "+userNum);
This line calculates and prints the square of user input
System.out.println(userNum+" squared is "+(userNum * userNum));
This line calculates and prints the cube of user input
System.out.println("And "+userNum+" cubed is "+(userNum * userNum * userNum)+"!!");
This signifies the beginning of number 3
System.out.println("3.");
This line prompts the user for another integer value
System.out.print("Enter Another integer: ");
This line accepts the input from the user
int userNum2 = input.nextInt();
This line adds the two inputs by the user and displays the result
System.out.println(userNum+" + "+userNum2+" is "+(userNum + userNum2));
This line multiplies the two inputs by the user and displays the result
System.out.println(userNum+" * "+userNum2+" is "+(userNum * userNum2));
#Write a function called 'string_type' which accepts one #string argument and determines what type of string it is. # # - If the string is empty, return "empty". # - If the string is a single character, return "character". # - If the string represents a single word, return "word". # The string is a single word if it has no spaces. # - If the string is a whole sentence, return "sentence". # The string is a sentence if it contains spaces, but # at most one period. # - If the string is a paragraph, return "paragraph". The # string is a paragraph if it contains both spaces and # multiple periods (we won't worry about other # punctuation marks). # - If the string is multiple paragraphs, return "page". # The string is a paragraph if it contains any newline # characters ("\n"). # #Hint: think carefully about what order you should check #these conditions in. # #Hint 2: remember, there exists a count() method that #counts the number of times a string appears in another #string. For example, "blah blah blah".count("blah") #would return 3.
Answer:
I am writing a Python program:
def string_type(string):
if string=="": //if the string is empty
return "empty"
elif string.count(".")>1: #if the period sign occurs more than once in string
if string.count("\n"): #checks if the new line occurs in the string
return "page" #if both the above cases are true then its a page
return "paragraph" # if the period sign condition is true then its a para
elif string.count(" ")>=1: #if no of spaces in string occur more than once
return "sentence" #returns sentence
elif len(string)==1: # if length of the string is 1 this
return "character" #returns character
else: #if none of the above conditions is true then its a word
return "word" #returns word
Explanation:
def string_type(string): this is the definition of method string_type which takes a string as argument and determines whether the type of string is a word, paragraph, page, sentence or empty.
if string=="" this if condition checks if the string is empty. If this condition is true then the method returns "empty"
elif string.count(".")>1 This condition checks if the string type is a paragragh
string.count(".")>1 and if string.count("\n") both statements check if the string type is a page.
Here the count() method is used which is used to return the number of times a specified string or character appears in the given string.
Suppose the string is "Paragraphs need to have multiple sentences. It's true.\n However, two is enough. Yes, two sentences can make a paragraph."
The if condition first checks if count(".")>1 which means it counts the occurrence of period i.e. "." in the string. If the period occurs more than once this means it could be a page. But it could also be a paragraph so in order to determine the correct string type another if statement if string.count("\n") inside elif statement determines if the string is a page or not. This statement checks the number of times a new line appears in the string. So this distinguishes the string type paragraph from string type page.
elif string.count(" ")>=1: statement determines if the string is a sentence. For example if the string is "i love to eat apples." count() method counts the number of times " " space appears in the string. If the space appears more than once this means this cannot be a single word or a character and it has more than one words. So this means its a sentence.
elif len(string)==1: this else if condition checks the length of the string. If the length of the string is 1 this means the string only has a single character. Suppose string is "!" Then the len (string) = 1 as it only contains exclamation mark character. So the method returns "character" . If none of the above if and elif conditions evaluates to true then this means the string type is a word.
Answer:
def string_type(string):
if string=="": //if the string is empty
return "empty"
elif string.count(".")>1: #if the period sign occurs more than once in string
if string.count("\n"): #checks if the new line occurs in the string
return "page" #if both the above cases are true then its a page
return "paragraph" # if the period sign condition is true then its a para
elif string.count(" ")>=1: #if no of spaces in string occur more than once
return "sentence" #returns sentence
Explanation:
"The correct syntax for passing an array as an argument to a method when a method is called and an array is passed to it is: "
Question:
"The correct syntax for passing an array as an argument to a method when a method is called and an array is passed to it is: "
A) a[0]..a[a.length]
B) a()
C) a
D) a[]
Answer:
The correct answer is A.
An example is given in the attachment.
Cheers!
The key schedule results in generating multiple keys from the one secret key. These multiple keys are used:
a. in multiple sessions of communications one after the other. For example, if someone has 12 keys, they can use it for twelve video calls one after the other.
b. such that one of them is picked up at random at a time.
c. some as private keys, some as public keys.
d. for different rounds of encryption for the same plaintext to strengthen the cipher.
Answer:
Option(d) is the correct answer to the given question .
Explanation:
There are various type of algorithm is used for the purpose of the key scheduling such as AES .in the AES algorithm we used same key for encryption and decryption of text .The main objective of the AES algorithm it is used by Various round of the similar plain text encryption to reinforce the cipher text.
The Option (a) is wrong because In the key scheduling the creating keys are not being used one after just another in the various communication cycles.The Option (b) is wrong because In the key scheduling we do not used the the random key for the encryption process .The Option (c) is wrong because we will never arbitrarily subdivided into groups of public and private key.
A script sets up user accounts and installs software for a machine. Which stage of the hardware lifecycle does this scenario belong to?
Answer:
deployment phase
Explanation:
This specific scenario belongs to the deployment phase of the hardware lifecycle. This phase is described as when the purchased hardware and software devices are deployed to the end-user, and systems implemented to define asset relationships. Meaning that everything is installed and set up for the end-user to be able to use it correctly.
Consider the following algorithm. x â 1 for i is in {1, 2, 3, 4} do for j is in {1, 2, 3} do x â x + x for k is in {1, 2, 3, 4, 5} do x â x + 1 x â x + 5 Count the number of + operations done by this algorithm.
Answer:
Number of + operation done by this algorithm is 60
Explanation:
i = 4
j = 3
k = 6
Now, let "n" be number of '+' operations
n = i × j + i × 2k
substituting the figures
n = 4 × 3 + 4 × (2 × 6)
n = 12 + 4 × 12
n = 12 + 48
n = 60
Answer:
i can't see some of the numbers
Explanation: