Answer:
True
Explanation:
for loop is used to repeat the process again and again until the condition not failed.
syntax:
for(initialize; condition; increment/decrement)
{
Statement
}
But we can omit the initialize or condition or increment/decrement as well
the syntax after omit the initialization,
for( ; condition; increment/decrement)
{
Statement
}
The above for loop is valid, it has no error.
Note: don't remove the semicolon.
You can omit the condition and increment/decrement.
and place the semicolon as it is. If you remove the semicolon, then the compiler show syntax error.
Following are the "dice_eval" method code into python language.
Program Explanation:
- Defining a method "dice_eval" that takes two variables "d1,d2" in its parametes.
- Inside the method, multiple conditional statements were used that adds the parameter values and calculates its value which can be defined as follows:
- In the if block, it adds the parameters and uses or gate that check its value that is equal to 7 or 11. so, it will return a string message that is 'Winner!'.
- In the elif block, it adds the parameters and uses or gate that check its value that is equal to 2 or 3 or 12. so, it will return a string message that is ' C r aps ! '.
- In the else block, it uses a return keyword that adds parameter value and prints a string value.
- Outside the method "d1,d2" is declared that inputs the value from the user-end, and passes the value into the method, and prints its value.
Program:
def dice_eval(d1, d2):#defining a method dice_eval that takes two parameters
if (d1+d2)==7 or (d1+d2)==11:#defining if block that adds parameter value and use or operator to check its value
return 'Winner!'#return string value
elif (d1+d2)==2 or (d1+d2)==3 or (d1+d2)==12:#defining elif block that adds parameter value and use or operator to check its value
return 'C r aps!'#return string value
else:#defining else block
return 'Point is '+str(d1+d2)#return string value with adding parameter
d1=int(input())#defining d1 that input value
d2=int(input())#defining d2 that input value
print(dice_eval(d1,d2))#calling method and print its return value
Output:
Please find the attached file
Please find the complete code in the attached file.
Learn more:
brainly.com/question/15011927
Answer:
b. cart total + 1
Explanation:
A. cart total=1 do increment the total with every 1 click here, it only 're-assigns cart total with value 1 for every click, hence it's always 1.
B. In every click, 1 is always added to the previous value of cart total, like addItemButton(cart total+1) or so.
C. This would have worked too if "cart total" and "cartTotal" where of same type.
D. cart total is just being initially defined here.
E. Likewise here, var shows that cart total has just only been declared.
Input device
A cpu processes all your programs
An input device is something like a keyboard or mouse, when you use it it inputs data to the computer
An output device is something like your headphones
Software is a program that you run like microsoft word