Reach for the stars | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Reach for the stars

My problem is it says no input however my answer matches the correct answer. What am I doing wrong? I have zero experience. Print("* \n** \n*** \n****")

12th Feb 2021, 7:59 PM
Jennifer Patrick
9 Answers
+ 3
The problem you're talking about is a Pro-only one, so us non-pro users cannot see it. It would be good if you'll copy the instructions here. My guess is that you need to output like this * ** *** **** So, I would suggest removing all the spaces between the '*' and the '\n' and trying with that.
12th Feb 2021, 8:07 PM
XXX
XXX - avatar
+ 2
This code tries to make a triangle out of stars. But oh no! There’s an error in there somewhere-it outputs all the stars on one line, instead of separate lines. Fix the code to output a triangle of stars that has 4 rows. You can use \n newlines to create line breaks in the string. Important: Remove any extra spaces to match the required output. print ("* ** *** ****") This is exactly how it looks.
12th Feb 2021, 8:11 PM
Jennifer Patrick
+ 1
Jennifer Patrick read the sentence starting with 'Important' "remove any extra spaces to match the required output" So, as I suggested in my previous answer, remove all the spaces from the string to be printed.
12th Feb 2021, 8:15 PM
XXX
XXX - avatar
+ 1
Thank you. I appreciate the help. I have very little knowledge for computers other than basic operations that are preset. My cousin was a programmer for Microsoft a long time ago I'm taking 90's long ago and I remember watching him program and I was intrigued. I figured I'd check it out and see if I like it enough to go further.
12th Feb 2021, 8:18 PM
Jennifer Patrick
+ 1
Jennifer Patrick space: " " new line: "\n"
12th Feb 2021, 8:19 PM
visph
visph - avatar
0
I got it. I had to remove the spaces. I tried that first and still got an error.
12th Feb 2021, 8:13 PM
Jennifer Patrick
0
print("*\n**\n***\n****")
26th May 2021, 1:39 PM
Orna
Orna - avatar
0
print("\n*\n**\n***\n****")
22nd Sep 2021, 8:50 AM
praveen
- 3
This is correct print("\n*\n**\n***\n****")
1st Aug 2021, 7:30 PM
Abhijeet Vishwakarma
Abhijeet Vishwakarma - avatar