range code | Sololearn: Learn to code for FREE!

0

range code

#like this but only one" while " count = 0 while count < 11 : print(count) count = count + 1 count = 10 while count > 0 : print(count) count = count - 1

11/16/2017 5:55:20 AM

zura bakuradze

12 Answers

New Answer

+1

deniel ok,If I understand I'll write it here.

+9

Perhaps something like count = -9 while count < 10: print(10-abs(count)) count += 1

+7

for i in range(0, 11): print(i) #prints same as 1st while for i in range(10, 0, -1): print(i) #prints same as 2nd while

+6

@Daniel I got that as an interview question years ago and that was the only thing that came to mind as a solution 😂

+4

What is your question ?

+1

no i need result like this : 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 but using only one "while"

+1

ace good but i need using "while"

+1

range code #like this but only one" while " count = 0 while count < 11 : print(count,sep=" ") count = count + 1 count = 10 while count > 0 : print(count,sep=" ") count = count - 1

+1

https://code.sololearn.com/cKbl020vre2P/?ref=app Well, when I wrote my last post I thought in that solution ;-)

+1

Ace I didnt checked your code but is better than mine for height ;-)

0

https://code.sololearn.com/clnMaCqnED0M/?ref=app Like that?

0

zura is impossible. 1 - Or you have some kind of code with print in specific position or table 2 - Or you print directly each number 3 - Or you use some kind of recursive function 4 - Well other thing is if you have an array with that number serie and with while print each number of it Anyway when you will have it, please share with us