Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

FizzBuzz in Python Using Conditional Statements

for num in range(1,101):
    string = ""
    if num % 3 == 0:
        string = string + "Fizz"
    if num % 4 == 0:
        string = string + "Buzz"
    if num % 4 != 0 and num % 3 != 0:
        string = string + str(num)
    print(string)
Comment

PREVIOUS NEXT
Code Example
Python :: Count the data points based on columns 
Python :: Insertion Sorting using while in python 
Python :: nbt python 
Python :: to create an array with values that are spaced linearly in a specified interval 
Python :: python string formatting - string truncating with format() 
Python :: search a number in 2d sorted 
Python :: walk nested dict python 
Python :: how to join bot into voice channel python 
Python :: Convert Int to String Using string formatting 
Python :: Creating a list with several elements that are distinct or duplicate 
Python :: droping columns 
Python :: maximum of a list in python recursively 
Python :: using format str with variable 
Python :: django updateview not saving 
Python :: velocity field gradient 
Python :: drop columns delta table 
Python :: Loading data from Oracle Database to pandas DataFrames 
Python :: Broadcasting with NumPy Arrays Plotting a two-dimensional function Example 
Python :: os.path.join not working 
Python :: differences between Pool.apply, Pool.apply_async, Pool.map and Pool.map_async. 
Python :: Python NumPy vstack Function Syntax 
Python :: Python NumPy append Function Example Working with axis 
Python :: mypy run on single file 
Python :: NumPy rot90 Syntax 
Python :: sourcetrail index library python 
Python :: should either include a `queryset` attribute, 
Python :: dictionary display 
Python :: bouton 
Python :: pygame borders on window 
Python :: browser environment: 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =