Given this paragraph about the experiment that led to the discovery of penicillin by Sir Alexander Fleming, tell me upon which types of bacteria penicillin has an anti-bacterial effect, and list the conditions that were necessary for the discovery of penicillin

By 1927, Fleming had been investigating the properties of staphylococci. He was already well known from his earlier work, and had developed a reputation as a brilliant researcher. In 1928, he studied the variation of Staphylococcus aureus grown under natural condition, after the work of Joseph Warwick Bigger, who discovered that the bacterium could grow into a variety of types (strains). On 3 September 1928, Fleming returned to his laboratory having spent a holiday with his family at Suffolk. Before leaving for his holiday, he inoculated staphylococci on culture plates and left them on a bench in a corner of his laboratory. On his return, Fleming noticed that one culture was contaminated with a fungus, and that the colonies of staphylococci immediately surrounding the fungus had been destroyed, whereas other staphylococci colonies farther away were normal, famously remarking "That's funny". Fleming showed the contaminated culture to his former assistant Merlin Pryce, who reminded him, "That's how you discovered lysozyme." He identified the mould as being from the genus Penicillium. He suspected it to be P. chrysogenum, but a colleague Charles J. La Touche identified it as P. rubrum. (It was later corrected as P. notatum and then officially accepted as P. chrysogenum; in 2011, it was resolved as P. rubens.)
The laboratory in which Fleming discovered and tested penicillin is preserved as the Alexander Fleming Laboratory Museum in St. Mary's Hospital, Paddington. The source of the fungal contaminant was established in 1966 as coming from La Touche's room, which was directly below Fleming's.
Fleming grew the mould in a pure culture and found that the culture broth contained an antibacterial substance. He investigated its anti-bacterial effect on many organisms, and noticed that it affected bacteria such as staphylococci and many other Gram-positive pathogens that cause scarlet fever, pneumonia, meningitis and diphtheria, but not typhoid fever or paratyphoid fever, which are caused by Gram-negative bacteria, for which he was seeking a cure at the time. It also affected Neisseria gonorrhoeae, which causes gonorrhoea, although this bacterium is Gram-negative. After some months of calling it "mould juice" or "the inhibitor", he gave the name penicillin on 7 March 1929 for the antibacterial substance present in the mould.

Penicillin has an anti-bacterial effect of a number of Gram-positive bacteria including but not limited to the bacteria that cause meningitis, diptheria, pneumonia, scarlet fever.  It also acts on (Gram-positive) staphylococci bacteria which cause skin and soft tissue infections such as boils.  Penicillin was also found to have an anti-bacterial action on the Gram-negative bacteria which causes gonorrhoea.  There were a series of fortuitous circumstances which combined to allow the discovery of penicillin, one of which was Sir Alexander's choice to take a holiday with his family after leaving staphylococci bacteria in a culture in his lab before departure.  Anecdotally Sir Alexander was a little sloppy with lab hygiene which contributed to his previous discovery of lysozyme and it seems the same lack of care was partly responsible for the discovery of penicillin.  Lastly the specific location of his lab and cultures played a role - the fungal contaminant that had an anti-bacterial effect on the staphylococci culture came from Sir Alexander's colleagues lab one floor below