Answer:
#Section 1
lst= []
lstNo=int(input("Enter even number of elements in List: "))
for i in range(0, lstNo):
pr=int(input(": " ))
lst.append(pr)
print(lst)
#Section 2
nlst=[]
dlst=[]
n =len(lst)
i=0
while (i < n/2):
nlst.append(lst[i])
i = i+1
j = n-1
while j >= n/2:
dlst.append(lst[j])
j = j-1
dlst.sort()
for a in range(len(dlst)):
nlst.append(dlst[a])
print(nlst)
Explanation:
#section 1:
An empty list is declared to hold the list inputs by the user <em>lst= []
</em>
The program then prompts the user to enter an even number of elements that will be contained in the list.
The for loop is used to iterate from zero(0) to the number of elements stated, in order to get the input that is appended to the list.
lastly, the list is printed out.
#Section 2:
In this section two new lists are created to hold one half of the value respectively.
The first list collects the first half of the list using a while loop and stores it, it does not perform any sorting on it.
The second list collects the second half using a while loop and sorts the list using the<em> .sort() </em>method which arranges elements in an ascending order.
Finally, the second list that has been sorted is added to the first and the result is printed to the screen.
A picture of how the code will run has been attached.
Answer:
A. Vegenere
Explanation:
<em>I think it's spelled Vigenère, I might be wrong.</em>
The three types of cryptograph are:
Symmetric Key Cryptography (Private/Secret Key Cryptography)
Asymmetric Key Cryptography (Public Key Cryptography)
Hash Function
Answer:
The code to this question can be given as:
code:
for(i=1;i<=n;i++) //for loop column
{
for(j=1;j<=i;j++) //for loop for rows
{
printf("*"); // print asterisks
}
printf("\n"); //line break
}
Explanation:
We know that variable i,j, and n is already declared and n variable has initialized a value. So, we write the code that is given above. In this code, we use a nested loop. In this code, we use two loops that are a loop (i)for column and j loop for rows. for print asterisks triangle we use two for loop. For that, we use two-variable (i,j) that is already declared. We assign the value in (i) loop that is 0 and checks that (i) is less than equal to n and increment of (i) by 1. In this loop, we use another loop that is (j) loop. It also starts from 1 and checks that (j) is less than equal to (i)and increment of (j) by 1. In that loop, we print asterisks end of (j) loop. In (i) loop we use ("\n") for line break end of (i) loop.