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

Loops in python

Hi, the question is to write a function that gets a number and print the amount of asterisks every line (* ** *** etc) And then write a loop thorough the first function. I added 2 solutions, but there's no output, why? https://code.sololearn.com/cu6OZvy9GgFl/?ref=app https://code.sololearn.com/cmSrc5fzW6RW/?ref=app

21st Oct 2022, 10:45 PM
Liat123
Liat123 - avatar
5 Answers
+ 3
Liat123 I believe you wanted something like this https://code.sololearn.com/c07EMK8nokea/?ref=app
22nd Oct 2022, 12:41 AM
BroFar
BroFar - avatar
+ 2
– The last print() is not correctly indented – print_atars() is not defined – there are no line breaks – You did not call any function
21st Oct 2022, 11:00 PM
Lisa
Lisa - avatar
0
The last print is under the last for loop where's the mistake? Print_stars define at the start..? There're no line breaks where? I didn't call the function where? Sorry for not understanding and thank you
21st Oct 2022, 11:06 PM
Liat123
Liat123 - avatar
0
Thank you so much! Can you explain why you used "print()" and "print("\n\n")"?
22nd Oct 2022, 7:22 AM
Liat123
Liat123 - avatar
0
Also, the exercise was to put stars like the number I put in the input. When I put 5, it only shows 4 rows. How to change it?
22nd Oct 2022, 7:26 AM
Liat123
Liat123 - avatar