Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
Alex Wairegi Yes! indentation is really boring! btw every block line should have the same indentation, that is, in your code `if` is more indented than `while` , it's correct and `print` is inside `if`, but i=i+1 isn't. It's between if and print, so the already confused interpreter gets more confused. put a space before i=i+1 so it will align with print and is inside if block. else can't have a direct condition (it's called when if condition is wrong). so you can write another if below or use `elif`. and again move i=i+1 below print. Since `x = str(input())` is outside `while` loop, only one input will be read, I guess you meant to read 4 values, so move it inside `while` block. https://code.sololearn.com/c0C73g88xoQp/?ref=app https://code.sololearn.com/c4Tmr9m2GJfB/?ref=app
4th Dec 2022, 11:11 AM
Tina
Tina - avatar
+ 3
Alex Wairegi You can make another question in that case with tags question related "c++, topic,.. ", as that helps for others also.. more chances to get answers! why to post here?
4th Dec 2022, 11:25 AM
Jayakrishna 🇮🇳
+ 2
Indentation is like levels, One indented line is one level inner to the upper code. There should be uniformity in the indentation. Same indentation for same level of code.
4th Dec 2022, 10:39 AM
Lucifer
+ 1
Indentations in Python are similar to the curly brackets {} in other languages and are a way to separate your code. They are followed by colon : from your statements. It lets the Python interpreter know that it's a piece of code that belongs to that block of code written.
6th Dec 2022, 7:58 AM
William Tran
0
Hello all help me For this code Idontknow what is this Stringlooparray Enter a number:(1-5 only): 5 //Output Nambawan Nambatwo Nambathree Nambapoor Nambapayb
6th Dec 2022, 6:42 AM
Sasuke
Sasuke - avatar
0
How to start coding
10th Dec 2022, 6:02 AM
Indian Future
Indian Future - avatar