Answer:
def fizzbuzz (num):
for item in range(num):
if item % 2 == 0 and item % 3 == 0:
print("fizzbuzz")
elif item % 3 == 0:
print("buzz")
elif item % 2 == 0:
print("fizz")
else:
print (item)
fizzbuzz(20)
Explanation:
Using Python programming Language
Use a for loop to iterate from 0 up to the number using the range function
Within the for loop use the modulo (%) operator to determine divisibility by 2 and 3 and print the required output
see attached program output screen.
Answer:
square brackets [ ] operator
Explanation:
<h2><u>Multiple choice</u></h2>
A reason to overload the<u> square brackets [ ] operator </u> is to write classes that have array-like behaviors
Hi!
Question 1: George W. Bush.
Question 2: I'm pretty sure it's excessive use of force.
Question 3: About 25 percent.
Question 4: True.
Question 5: To ensure the safety of officers and inmates and to punish those who break the rules.
Question 6: I believe it is false.
Question 7: True.
Question 12: John F. Kennedy.
Question 13: I believe it's False.
Question 15: False.
That's all I know!
Answer:
c. Book and Periodical are subclasses of LoanableItem
Explanation:
Books are kept in library in a periodical manner. Both classes are not superior, they are subclasses of LoanableItem. Library uses common guide which makes it easy to find a book.
Answer:
In VB.net the keyword Static is not meant the same as in C#. In VB.net the static variable is termed as the shared variable and has the scope throughout the class. And this intStatic and intclass means the same. And for intClass we use the shared keyword, as shown in the image attached.
Explanation:
Here num2 is a local variable, and num2 is a shared variable. a is constant and used for incrementing. The rest is explained in the image.