Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyBoolNone
#python 3.6.9 #PyBoolNone #append() and len() methods' credit goes to pythontutorial.net. Modifications and rest of the code created by Rezaul Hoque on March 14,2022. #contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com #note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; def append(item, basket=None): if basket is None: basket = [] basket.append(item) return basket basket=['soap','milk','toothpaste'] append('shampoo',basket) #if __len__() is zero bool() constructor returns false otherwise it returns true if basket is not None and len(basket) > 0: for element in basket: print(element) else: print('Basket is empty')
run
|
edit
|
history
|
help
0
Student
Python | Random elements with atleast K occurrences
(P3) Hamming 1
Square numbers
latency
Calculator
Submission.py
Recur_fact_stkovrflw
fibonacciseries
highest score question NPTEL