The program is an illustration of loops; Loops are program statements used for repetition of operations
<h3>How to complete the code?</h3>
The complete question is added as an attachment
The code written in Python that completes the missing parameters in the question are:
def nested_sum(mylist):
total = 0
for other_list in mylist:
total += sum(other_list)
print(total)
t = [[1,2],[3],[4,5,6]]
nested_sum(t)
nested_sum( eval(input()))
Read more about loops at:
brainly.com/question/24833629
#SPJ11
Answer:
Check explanation
Explanation:
# include <iostream>
using namespace std;
int main()
{
char op;
float a, b;
cout << "Enter operator either + or - or * or /: ";
cin >> op;
cout << "Enter two operands: ";
cin >> num1 >> num2;
switch(op)
{
case '+':
cout << a + b;
break;
case '-':
cout << a - b;
break;
case '*':
cout << a * b;
break;
case '/':
cout << a / b;
break;
default:
cout << "This operator is not valid. Please try again.";
break;
}
return 0;
}
Answer:
void calculatеAvеragе(double array1[],int count);//function declaration
Explanation:
Here we are declared a function calculatеAvеragе() of void return type because there is no return type is mention in the question so I take void return type. The calculatеAvеragе() function takes two parameters one is an array of type double and other is a variable count of int types.
To declared any function we used following syntax
return_type functionname(parameter 1,parameter 2 .....parameter n)
So void calculatеAvеragе(double array1[],int count);
Answer:
value=int(input("Enter the value from where the user wants to starts: "))#Take the value from the user.
i=1#intialize the value of a variable by 1.
while(value<1000) and (i<9):#while loop which prints the value.
print(value,end=" ")# print the value.
value=value*2#calculate the value to print.
i=i+1#calculate the value for the count.
Output:
If the user enter 5, then the output is : "5 10 20 40 80 160 320 640".
If the user enter 5, then the output is : "3 6 12 24 48 96 192 384".
Explanation:
- The above code is in python language, in which the first line of the program is used to render a message to the user, take the input from the user and store it into value variable after converting it into an integer.
- Then the loop will calculate the double value and then it prints the value with the help of print function.
- The end function puts the spaces between numbers.