Question: python3. what wrong with my code? when given a number N, for each integer i in the range from 1 to N inclusive, print one

python3. what wrong with my code?

when given a number N, for each integer i in the range from 1 to N inclusive, print one value per line as follows:

-if i is a multiple of both 3 and 5, print FizzBuzz

-if i is a multiple of 3 but not 5, print Fizz

-if i is a multiple of 5 but not 3, print Buzz

-if i is not a multiple of 3 or 5, print value of i.

"""

inputNum, represents the given number.

"""

def funcFizzBuzz(inputNum):

# Write your code here

if inputNum % 3 == 0 and inputNum % 5 == 0:

return 'FizzBuzz'

elif inputNum % 3 == 0:

return 'Fizz'

elif inputNum % 5 == 0:

return 'Buzz'

else:

return inputNum

def main():

#input for inputNum

inputNum = int(input())

result = funcFizzBuzz(inputNum)

print(result)

if __name__ == "__main__":

main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!