Frequent cleaning with an air duster can would do the job
Answer:
Following are the answer to this question:
x=int(input("Enter number: "))#defining x variable that input value from user end
if x< 0:#defining if block that check x value is less then 0
while x<0:#defining while loop print up to the value
print(x)#print value
x+= 1#add values by 1
elif x>0:#defining elif block to check value x is greater than 0
while x>0:#defining while loop to print down to value
print(x)#print value
x-= 1#subtract value by 1
Output:
when input is a positive value
Enter number: 5
5
4
3
2
1
when input is a negative value
Enter number: -5
-5
-4
-3
-2
-1
Explanation:
- In the given python code, x variable is declared that input the value from the user end, in the next step if and elseif block is declared that calculates and prints its value.
- In the if block, it checks value is negative it uses the while loop to prints its values in the down to value form.
- In the elif block, it checks the positive it uses the while loop to prints its values into the up to values form.
An array of integers named parkingTickets has been declared and initialized to the number of parking tickets given out by the city police each day since the beginning of the current year.
Explanation:
- A variable named ndays has been declared and initialized to hold the size of the array.
- The first element of the array contains the number of tickets given on January 1; the last element contains the number of tickets given today.
- A variable named mostTickets has been declared, along with a variable k.
- If today were January 18, ndays would have the value 18; if today were February 3, ndays would have the value 34
mostTickets=0;
for (k=0; k< ndays; k++)
{
if (parkingTickets[k]>mostTickets) mostTickets=parkingTickets[k];
}
Answer: True
Explanation:
Yes, the given statement is true that that one of the quality of the wireless networks is that they uses the various radio techniques and the radio frequency.
By using this techniques, the wireless transmission occur and it enable the connectivity and allow the direction of transmission to eavesdrop. It is one of the best technique as compared to the traditional method which include copper and fiber.
Answer:
Explanation:
The following code is written in Python. It creates a method for each one of the questions asked and then tests all three with the same test case which can be seen in the picture attached below.
def alternating_list(lst1, lst2):
lst3 = []
for x in range(len(lst1)):
lst3.append(lst1[x])
try:
lst3.append(lst2[x])
except:
pass
if len(lst2) > len(lst1):
lst3.extend(lst2[len(lst1):])
return lst3
def reverse_alternating(lst1, lst2):
lst3 = []
if len(lst1) == len(lst2):
for x in range(len(lst1) - 1, -1, -1):
lst3.append(lst1[x])
lst3.append(lst2[x])
return lst3
def alternating_list_no_extra(lst1, lst2):
lst3 = []
max = 0
if len(lst1) > len(lst2):
max = len(lst2)
else:
max = len(lst1)
for x in range(max):
lst3.append(lst1[x])
try:
lst3.append(lst2[x])
except:
pass
return lst3