Answer:
You may use a different variable type for input in order to process the data appropriately and may use a different variable type to accommodate your program.
Explanation:
Your input may have to be different then output varying on what data you are processing.
For example, just like the last question you asked about calculating the area of the rectangle, your input MUST be converted to a different a numerical data type (i.e int or float) in order to do the math.
Based on your last question, if we didn't convert your input into a string your results wouldn't add the numbers together but only concatenate them. If I typed 3 & 5 as length & width, I would get 35 instead of 15.
Now another example is using functions (or methods whatever you want to call them), your input can be one thing and outputs another.
Let's say I want a function to tell me if I am smart. The way I want it to determine if its smart is by inputting my GPA into it, which is a numerical value. So the function would look something like this:
<u>Code (Python)</u>
def IsSmart(gpa):
if (gpa >= 4):
return True
else
return False
As you can see I am inputting a numerical value and it is outputting a boolean value. I can use this in a if else chain to spit out an output to the user.
Answer:
from collections import Counter
def anagram(dictionary, query):
newList =[]
for element in dictionary:
for item in query:
word = 0
count = 0
for i in [x for x in item]:
if i in element:
count += 1
if count == len(item):
newList.append(item)
ans = list()
for point in Counter(newList).items():
ans.append(point)
print(ans)
mylist = ['jack', 'run', 'contain', 'reserve','hack','mack', 'cantoneese', 'nurse']
setter = ['ack', 'nur', 'can', 'con', 'reeve', 'serve']
anagram(mylist, setter)
Explanation:
The Counter class is used to create a dictionary that counts the number of anagrams in the created list 'newList' and then the counter is looped through to append the items (tuple of key and value pairs) to the 'ans' list which is printed as output.
Answer:
(c) system.exist(1);
Explanation:
system.exist(1); is used for the termination of the program here both option c and d should be correct but in option d there is exit(0) and zero indicates return means program will return but besides zero if there is any non zero number then program will not return and in option c there is a non zero number which means program will not return so option c system.exist(1); will be the correct option for the termination of program
Answer:
Public key encryption
Explanation:
DescriptionPublic-key cryptography, or asymmetric cryptography, is a cryptographic system that uses pairs of keys: public keys which may be disseminated widely, and private keys which are known only to the owner.
Computer hardware<span> is any physical device used in or with your machine, whereas</span>software<span> is a collection of code installed onto your computer's hard drive. For example, the computer monitor you are using to read this text and the mouse you are using to navigate this web page is computer </span>hardware<span>.</span>