Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
*******O**
******O***
******O***
*O********
*****O****

What I have tried:

i=1
m=0
while i<=5:
    j=1
    m=m+1

    while j<=10:
        if j==m+7:
            print('O',end='')
        else:
            print('*',end='')
        j=j+1
    print()
    i=i+1
Posted
Updated 2-Oct-17 6:10am
v2

OK, so you have to basic logic down. You just need to replace the "m=m+1" line with something that generates a random number, "m=something...".

You should also get rid of the "m+7" thing and make that just "m".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900