0
how to print in python
how to print this using nested loops? 👇 * ** *** **** ***** **** *** ** *
11 Réponses
+ 5
This is solved using nested loops. Try to think for the logic before solving the question.
https://code.sololearn.com/cvBhhg516Ihy/?ref=app
+ 5
Wow, Jan Markus. Nice one-liner used 🤩🤩
+ 4
Jan Markus nice...
But his teacher will smell the Braten and then...😤😤😤
Trotzdem....wirklich hübsch.
+ 4
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
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.
+ 3
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()
+ 2
Jan Markus which font did you used to write code??
+ 2
for i in range(1):
for j in range(1):
print("*\n**\n***\n****\n*****\n****\n***\n**\n*")
+ 1
Jan Markus zeig mal den oneliner...
+ 1
print(2*2)
= 4 program finishes.
Symbol (*) mean multiplication try it and hope this helps you! Check my projects for more info!
0
hi
for 𝚒 in 𝚛𝚊𝚗𝚐𝚎(-4,5):
if i<0:
print((5-(-1*𝚒))*'*')
else:
print((5-(𝚒))*'*')