1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andru [333]
3 years ago
15

a. Write a function called fizzbuzz. This function will take 1 number as a parameter. The function will print all numbers from 0

up to the number input (non-inclusive), but, if the number is divisible by 2 you will print fizz instead, and if the number is divisible by 3 you will print buzz instead. If it is divisible by both you will print fizzbuzz

Computers and Technology
1 answer:
OLga [1]3 years ago
5 0

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.

You might be interested in
What is the diffrence between the the grassland and the savanna biomes
sergey [27]

Answer:

The term "savanna" is often used to refer to open grassland with some tree cover, while "grassland" refers to a grassy ecosystem with little or no tree cover.

Explanation:

5 0
3 years ago
Read 2 more answers
Write a program that prompts the user for an integer, then asks the user to enter that many values. Store these values in an arr
Svetllana [295]

Answer:

//The Scanner class is imported to allow the program receive user input

import java.util.Scanner;

//The class Solution is defined

public class Solution {

   //The main method is defined here and signify the beginning of program execution

   public static void main(String args[]) {

       

       //Scanner object 'scan' is created to receive user input

       Scanner scan = new Scanner(System.in);

       //Prompt display to the user to enter size of array

       System.out.print("Enter the range of array: ");

       //User input is assigned to arraySize

       int arraySize = scan.nextInt();

       //userArray is initialized with arraySize as its size

       int[] userArray = new int[arraySize];

       

       //counter to count number of array element

       int count = 0;

       //while loop which continue executing till the user finish entering the array element

       while (count < arraySize){

           System.out.print("Enter each element of the array: ");

           userArray[count] = scan.nextInt();

           count++;

       }

       

       //A blank line is printed for clarity

       System.out.println();

       

       //for loop to print each element of the array on straight line

       for(int i =0; i <userArray.length; i++){

           System.out.print(userArray[i] + " ");

       }

       

       //A blank line is printed for clarity

       System.out.println();

       

       //for loop is use to reverse the array in-place

       for(int i=0; i<userArray.length/2; i++){

           int temp = userArray[i];

           userArray[i] = userArray[userArray.length -i -1];

           userArray[userArray.length -i -1] = temp;

       }

       

       //for loop to print each element of the reversed array on straight line

       for(int i =0; i <userArray.length; i++){

           System.out.print(userArray[i] + " ");

       }

     

   }

}

Explanation:

The program is commented to give detailed explanation.

The for-loop use in reversing the array works by first dividing the array into two half and exchanging the first half elements with the second half elements. The element from the first half is assigned to temp variable on each loop, then the element is replaced with the equivalent element from the second half. And the element from the second half is replaced with the value of temp.

3 0
3 years ago
PLEASEE HELPP.... QUESTION... how does coding impact your life​
nataly862011 [7]

Answer: It allows us to do everyday tasks on the internet

Explanation: We wouldn’t be able to email, research, etc without coding!

6 0
3 years ago
Read 2 more answers
Which is true about a computerized spreadsheet?
morpeh [17]
"A computerized spreadsheet automatically recalculates when changes are made to the data" is the one among the following that <span>is true about a computerized spreadsheet. The correct option among all the options that are given in the question is the third option or option "C". I hope it helps you.</span>
5 0
3 years ago
A customer is looking to replace three aging network servers that are not able to keep up with the growing demand of the company
weeeeeb [17]

Answer:

c. Type 1 hypervisor installed directly on server hardware.

Explanation:

The customer plans to replace the old network services to ensure that the operation and service of the company is fast and up-to-date. The old servers will slow down the activities of the company and can also affect the overall company's output. The best option is to use and type 1 hypervisor and it should be installed on the server hardware directly.

6 0
3 years ago
Other questions:
  • Jim has entered the age of each of his classmates in cells A1 through A65 of a spreadsheet. Which function should Jim use to fin
    11·2 answers
  • Today, air travel allows large numbers of people to move quickly over long distances. Which of the following is a likely effect
    8·1 answer
  • You work administrative assistant in an engineering firm. A co-worker constantly makes fun of the engineers by whispering commen
    13·1 answer
  • kevin is working on a financial project that involves a lot of statistical information. He needs software that allows him to ent
    8·2 answers
  • [Submit on zyLabs] Please write a function with one input, a matrix, and one output, a matrix of the same size. The output matri
    10·1 answer
  • Write a program that converst the temperature from Celcius to Fahrenheit. The formula is: F (9/5)C+32
    12·2 answers
  • The interaction between information technology and organizations is influenced___________.A) solely by the decision making of mi
    12·1 answer
  • An application programming interface (API) is ________. A) the code the application software uses to take advantage of code writ
    11·1 answer
  • Microsoft’s SharePoint server product dramatically altered the content and records management (RM) markets. Crocker (2015), edit
    6·1 answer
  • Task 1 – File Input
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!