how to print in python | SoloLearn: Learn to code for FREE!

+1

how to print in python

how to print this using nested loops? ๐Ÿ‘‡ * ** *** **** ***** **** *** ** *

5/9/2021 5:15:05 PM

Hosein

12 Answers

New Answer

+7

Frogged kannst Du gerne haben: [๐š™๐š›๐š’๐š—๐š((5-๐šŠ๐š‹๐šœ(๐š’))*'*') ๐š๐š˜๐š› ๐š’ ๐š’๐š— ๐š›๐šŠ๐š—๐š๐šŽ(-4,5)]

+4

Wow, Jan Markus. Nice one-liner used ๐Ÿคฉ๐Ÿคฉ

+4

AKSHAY๐Ÿ‡ฎ๐Ÿ‡ณ [INACTIVE] Android App: "Stylish Text" Font number: 116 On Windows-Systems it is often called "Courier". In the Android-app the fonts have no names.

+3

Jan Markus nice... But his teacher will smell the Braten and then...๐Ÿ˜ค๐Ÿ˜ค๐Ÿ˜ค Trotzdem....wirklich hübsch.

+3

Finally....one loop for each row and the nested one for the cols like Adam Riese would have told us if he was born a bit later. Concerning the ranges ....Jan Markus did the work for u.

+3

This is solved using nested loops. Try to think for the logic before solving the question. https://code.sololearn.com/cvBhhg516Ihy/?ref=app

+2

First of all, have you tried your best, before posting this question. Because you won't be able to learn programming if you ask others for direct answers of these questions. I know it might appear like a lecture to you, but this is the way everyone learns Programming, even if you aren't able to find the correct answer, your time spent on thinking will not go waste, it will develop your logic and will force your brain to adapt to new requirements. Atleast put your code where you have tried to solve it, in this way we can hint you about the mistakes that you are making. At that point if you are making any small mistake, we can simply tell you the answer. But if you don't understand the logic behind it and are simply trying to take shortcut, then it will be a big hurdle in your growth.

+2

I can do it even without nested loops within an oneliner. ๐Ÿค” Or does your teacher insist on using nested loops?

+2

Try it like this: n = 5 for i in range (1, n + 1): for j in range (1, i + 1): print ('*', end = '') print() for i in range (n, 0, -1): for j in range (1, i + 1): print ('*', end = '') print()

+1

Jan Markus which font did you used to write code??

0

Jan Markus zeig mal den oneliner...

0

hi for ๐š’ in ๐š›๐šŠ๐š—๐š๐šŽ(-4,5): if i<0: print((5-(-1*๐š’))*'*') else: print((5-(๐š’))*'*')