Generating random flower nameĀ
Description:
To generate random flower name first we need to create a list of different flower names and then we can use the function called ‘random.choice’ this will help to select randomly.
firstly create a list of flower names.
secondly selecting a random name.
thirdly printing the random flower name.
Code for Generating random flower name using ‘random.choice’ in python:
import random
flower_names = [“rose”, “sunflower”, “lily”, “lotus”, “tulip”, “jasmine”, “daisy”, “lavender”]
random_flower = random.choice(flower_names)
print(“The random flower name is: {random_flower}”)
Output:
The random flower name is: lotus