Answer:
Encrypted message: CPONYIERTN
Explanation:
Message = ENCRYPTION
keyword = ONE
keyword ONE is of length 3 so the rows are of length 3
Permutation is given by the alphabetical order of the letters in the keyword ONE. Here E appears first in alphabet, then comes N and in last comes O so the order would be 321.
Now the message ENCRYPTION is written in tabular form with width of the rows defined by a keyword ONE
O N E
3 2 1
E N C
R Y P
T I O
N
Now this message is read by the column in alphabetic order of the keyword ONE.
Since alphabetic order of E is 1 so the column under E is read first which has the letters:
CPO
Then column under N is read which has the letters:
NYI
In the last the column under O is read which has the letters:
ERTN
So the encrypted message is:
CPONYIERTN
Answer:
The method in Java is as follows:
public static ArrayList<Integer> appendPosSum(ArrayList<Integer> nums) {
int sum = 0;
ArrayList<Integer> newArr = new ArrayList<>();
for(int num : nums) {
if(num>0){
sum+=num;
newArr.add(num); } }
newArr.add(sum);
return newArr;
}
Explanation:
This defines the method; it receives an integer arraylist as its parameter; nums
public static ArrayList<Integer> appendPosSum(ArrayList<Integer> nums) {
This initializes sum to 0
int sum = 0;
This declares a new integer arraylist; newArr
ArrayList<Integer> newArr = new ArrayList<>();
This iterates through nums
for(int num : nums) {
If current element is greater than 0
if(num>0){
This sum is taken
sum+=num;
And the element is added to newArr
newArr.add(num); } }
At the end of the iteration; this adds the calculated sum to newArr
newArr.add(sum);
This returns newArr
return newArr;
}
I'm assuming you are referring to Excel. There are a few ways to add A1 and B1.
First you could use '=SUM(A1+B1)'
You could also use '=SUM(A1:B1)' which adds the values of all the cells between A1 and B1, but since they are next to each other, this would work.
You could also use '=SUM(A1,B1)' where you list all the cells you want to add with commas in between.
Over here lol- it’s pretty cool
Answer:
import
Explanation:
the <em>import </em>keyword is used to import external modules into a python script.