Answer:
The output is 110 when the question's segment is executed and the input is given as 18,25,61,6,-1.
Explanation:
The program segment is used to add the user input value until the value is not "-1". It means that if a user gives the input "-1" then the program will get terminated and prints the addition of previously entered value by the user. The output is 110 for the input of (18,25,61,6,-1) because the addition of (18,25,61,6) is (110) and "-1" use to terminate the program. The program statement is described below--
- The First statement initiates an object of "Scanner" class which helps to call the input function to take the user input.
- The Second statement initializes the 0 value to the "sum" variable which is an integer type.
- The Third statement calls the "nextInt()" function to take the user input by the help of scanner class object and store it on a num variable which is an integer type.
- The Fourth statement is a "while" loop which gives false when the user's input is "-1".
- The Fifth statement adds the new value with the previously added value.
- The Sixth statement takes the new input from the user.
- The Seventh statement prints the previous added when the loop gets terminated.
To create a formula in Excel, you would first click in one of cells .
Answer:
'!'
Explanation:
In python, a string can be traversed from end very easily by using negative indexes, so, if index 0 points to the first element of the string, then, index -1 will point to the last element of the string, that is why, when data[-1] is printed last element of data, which is '!' is printed. Also, it can take more parameters separated by a colon, which are end index and step.