4 ответов
+ 5
You can use a loop and increment a variable, which can be converted to a string and add to X.
+ 4
Hint:
You can easily use a for loop to iterate on a range of 1 to 10. While iterating on the range, use the str() function to convert each number to string. Then print "X" added to the string form of the number.
+ 2
Please provide link to your attempt.
0
Solved it using string and integer. I remember was an easier way to do this. All in one line instead of using if else statement.
I used if else statement because in reality I wanted to increment A001 to A100. So I used if else statement. If you have a better way to get this done to save on time complexity please share.