The synonym for term port is seaport
Answer:
The difference between While loop and Do - While loop are explained below.
Explanation:
- While loop : It is a looping procedure in which the statements inside the while loop are executed depending on the condition outside the while before starting the loop.
- If the condition is true then the code inside loop is executed otherwise not.
- Do - While loop: It is a looping procedure in which the statements inside the loop get executed and then the condition at the end of the loop is checked.
- This means even the condition is fails the statements inside the loop are executed once.
- Do while loop name itself suggests that "do the while and then check the condition".
Answer:
function findLongestWord(str) {
var longestWord = str.split(' ').sort(function(a, b) { return b.length - a.length; });
return longestWord[0].length;
}
findLongestWord(InputHere);
Explanation:
Replace InputHere with the input
Answer:
count_p = 0
count_n = 0
total = 0
while True:
number = int(input("Enter an integer, the input ends if it is 0: "))
if number == 0:
break
else:
total += number
if number > 0:
count_p += 1
elif number < 0:
count_n += 1
print("The number of positives is: " + str(count_p))
print("The number of negatives is: " + str(count_n))
print("The total is: " + str(total))
print("The average is: " + str(total / (count_p + count_n)))
Explanation:
Initialize the variables, count_p represens the number of positives, count_n represents the number of negatives, and total represents the total of the numbers
Create a while loop iterates until the user enters 0. If the number is not 0, then add it to the total. If the number is greater than 0, increase count_p by 1. If the number is smaller than 0, increase count_n by 1.
When the loop is done, print the count_p, count_n, total, and average
Any information on a website should be findable within 3 mouse clicks.