Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
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****")
9 Antworten
+ 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.
+ 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.
+ 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.
+ 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.
+ 1
Jennifer Patrick
space: " "
new line: "\n"
0
I got it. I had to remove the spaces. I tried that first and still got an error.
0
print("*\n**\n***\n****")
0
print("\n*\n**\n***\n****")
- 3
This is correct
print("\n*\n**\n***\n****")