how to print in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to print in python

how to print this using nested loops? 👇 * ** *** **** ***** **** *** ** *

9th May 2021, 5:15 PM
Hosein
Hosein - avatar
11 Answers
+ 5
This is solved using nested loops. Try to think for the logic before solving the question. https://code.sololearn.com/cvBhhg516Ihy/?ref=app
11th May 2021, 3:24 AM
MrMysterious5
+ 5
Wow, Jan Markus. Nice one-liner used 🤩🤩
11th May 2021, 3:25 AM
MrMysterious5
+ 4
Jan Markus nice... But his teacher will smell the Braten and then...😤😤😤 Trotzdem....wirklich hübsch.
9th May 2021, 7:55 PM
Oma Falk
Oma Falk - avatar
+ 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.
9th May 2021, 7:58 PM
Oma Falk
Oma Falk - avatar
+ 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.
9th May 2021, 5:49 PM
Aniket kumar
Aniket kumar - avatar
+ 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()
11th May 2021, 8:13 AM
Сергей Маслов
Сергей Маслов - avatar
+ 2
Jan Markus which font did you used to write code??
11th May 2021, 11:24 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 2
for i in range(1): for j in range(1): print("*\n**\n***\n****\n*****\n****\n***\n**\n*")
18th Jun 2021, 7:21 AM
#0009e7 [get]
#0009e7 [get] - avatar
+ 1
Jan Markus zeig mal den oneliner...
9th May 2021, 7:41 PM
Oma Falk
Oma Falk - avatar
+ 1
print(2*2) = 4 program finishes. Symbol (*) mean multiplication try it and hope this helps you! Check my projects for more info!
18th Mar 2022, 5:43 PM
Hrithika
Hrithika - avatar
0
hi for 𝚒 in 𝚛𝚊𝚗𝚐𝚎(-4,5): if i<0: print((5-(-1*𝚒))*'*') else: print((5-(𝚒))*'*')
11th May 2021, 4:58 PM
Masroor Javadi
Masroor Javadi - avatar