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
Thiết kế biểu đồ thực thể liên kết và tập lược đồ cơ sở dữ liệu quan hệ cho các bài toán quản lý sau:
Paladinen [302]

Answer:

sorry please write in English than i help.you i don't understand your language

3 0
2 years ago
HELP ASAP PLZZZZZ
musickatia [10]

Answer:

third one

Explanation:

3 0
2 years ago
Volume of a cuboid is 14400 ​
Yanka [14]

Answer:

WHAT?

Explanation:

8 0
2 years ago
I made a fish emoji what do you think >{'_'}< should I change anything
Anvisha [2.4K]

Answer: It is beautiful

Explanation:

3 0
2 years ago
Read 2 more answers
In your own words, explain at least one reason why programming languages have functions.
Nataly [62]
Programming languages have functions because, they are the set of operations that may be applied to objects of that particular class.
for an example I will attach a function, you just check it

brainliest pls

5 0
3 years ago
Other questions:
  • Which of the following describes a Trojan horse?
    11·1 answer
  • Which of these sites would need additional investigation to check for reliability?
    8·2 answers
  • Which of the following best define grit
    13·1 answer
  • The file type ____ identifies a word 2013 document.
    11·1 answer
  • Write the definition of a class Clock. The class has no constructors and three instance variables. One is of type int called hou
    12·1 answer
  • Most operating systems perform these tasks.
    7·2 answers
  • What effect does social media have on teens?
    10·2 answers
  • Which of the following statements is true regarding a user account? Once a user account has been created, it cannot be completel
    8·1 answer
  • Which type of shape allows you to add text that can be moved around.
    11·1 answer
  • In order to view a page break what should you do
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!