Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

FizzBuzz in Python Using String Concatenation

for num in range(1,21):
 string = “”
 if num % 3 == 0:
 string = string + “Fizz”
 if num % 5 == 0:
 string = string + “Buzz”
 if num % 5 != 0 and num % 3 != 0:
 string = string + str(num)
 print(string)
Comment

PREVIOUS NEXT
Code Example
Python :: xgb model prediction changes if i save and load the model 
Python :: two lists with identical entries get order 
Python :: pop tkinter to the front of the screen 
Python :: Specifying your data type 
Python :: python list find 
Python :: extracting bounding box from xml file python 
Python :: Set symmetric Using the Symmetric Difference Operator (^) Method 
Python :: Examples pandas.read_hfd5() 
Python :: Convert Int to String Using F-strings 
Python :: add Elements to Python list Using extend() method 
Python :: how to use js in python 
Python :: faceModel = "opencv_face_detector_uint8.pb" 
Python :: Combining functions 
Python :: python replace every space, dash and parentheses into underscore 
Python :: bulet in jupyter notebook 
Python :: CHECK POLYGON IS VALID 
Python :: python split respect quotes 
Python :: Python NumPy atleast_3d Function Syntax 
Python :: in django drowpdown list shown in database tables 
Python :: python generate string of length 
Python :: Python NumPy vstack Function Example with 1d array 
Python :: Python NumPy insert Function Example Working with Scalars 
Python :: How to obtain a jpeg resolution in python 
Python :: NumPy rot90 Example Rotating Once 
Python :: Create a list of multiples of 3 from 0 to 20. 
Python :: Printing a long code line to span over multiple lines 
Python :: adjugate of 3x3 matrix in python 
Python :: python code to java code converter 
Python :: lda from scratch implementation on iris python 
Python :: extract data using selenium and disable javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =