Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
GardenerList
#Python 2.7.17 #GardenerList: use of different list methods and demonstration of mutability #this code is created by Rezaul Hoque on October 21,2021;contact: jewelmrh@yahoo.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; garden = () if not garden: print "Garden is empty.\n" input("Press enter key to continue\n"); garden=[ "Night Queen","Marigold","Jasmine","Rose","Daisy","China-rose"]; print "Your garden has:\n", garden print "Flower trees are:\n" for i in garden: print i if "Night Queen" in garden: print "The fragrance will reign the neighborhood.\n" flow=input("Do you have Sunflower in your garden?\n") if "Sunflower" in garden: print "Yes, I have\n" else: print "No,I don't have any." print "\nSlice example:\n" print "garden[ ",0,":" ,4,"]\t\n", print garden[0:4] pot = ["Sunflower", "Juhi"] print "\nYou've just bought new plants." garden += pot print "\nYour garden has: \n", for i in garden: print i print " \nYou just exchanged Marigold and China-rose plants for Butea and Narcissus plants." if "Marigold" in garden: garden.remove("Marigold") del garden[5] garden.append("Butea") garden.insert(0, "Narcissus") print "\nYour garden has: ", len(garden)," plants" print "\nThey are:" for i in garden: print i garden.sort() print "\nAfter sort they are: " for i in garden: print i input("\nPress the enter key to exit.")
run
|
edit
|
history
|
help
0
coupon
MPS2
codeacademy python tasks
PyClassInit
PyAddBook
binary
Shabnam_name_checker
L100
PyNameMangling
TIC TAC TOW.py