chevron_left chevron_right
• 0 Vote(s) - 0 Average

 Bronze Python Challenge filter_list Linear Mode Threaded Mode View a Printable Version Author Message
RE: Python Challenge #9
Dun it

Code:
```for i in range(-3,4):     spaces = ""     ast = ""     for x in range(0,abs(i)):         spaces += " "     for y in range(0,7-2*abs(i)):         ast += "*"     print(spaces,ast,spaces)```

(I didn't read the post properly, he's an updated one)
Code:
```for i in range(-3,4):     spaces = ""     ast = ""     a = ""     for x in range(0,abs(i)):         print(" ", end="")     for y in range(0,7-2*abs(i)):         print("*", end="")     for z in range(0,abs(i)+1):         if z == abs(i):             print(" ", end="\n")         else:             print(" ", end="")```

The print function has a parameter that allows you to print in the same line again.

2 users Like Rick's post

 Messages In This Thread Python Challenge - by Nil - 10-18-2015, 07:42 PM RE: *Simple* Python Challenge - by Eclipse - 10-18-2015, 08:12 PM RE: *Simple* Python Challenge - by Nil - 10-18-2015, 08:21 PM RE: Python Challenge - by m0dem - 10-19-2015, 04:45 AM RE: Python Challenge - by Nil - 10-19-2015, 03:23 PM RE: Python Challenge - by m0dem - 10-19-2015, 03:30 PM RE: Python Challenge - by Nil - 10-19-2015, 03:43 PM RE: Python Challenge - by Eclipse - 10-19-2015, 08:06 AM RE: Python Challenge - by Rick - 11-14-2015, 08:19 PM RE: Python Challenge - by Megan - 12-12-2015, 01:22 PM RE: Python Challenge - by Nil - 12-12-2015, 07:59 PM RE: Python Challenge - by Megan - 12-12-2015, 08:03 PM RE: Python Challenge - by Nil - 12-12-2015, 08:49 PM RE: Python Challenge - by Megan - 12-12-2015, 08:52 PM RE: Python Challenge - by Nil - 12-12-2015, 08:55 PM RE: Python Challenge - by Megan - 12-12-2015, 08:56 PM

Users browsing this thread: 1 Guest(s)