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

16th Nov 2017, 5:55 AM
zura bakuradze
zura bakuradze - avatar
12 Answers
+ 1
deniel ok,If I understand I'll write it here.
20th Nov 2017, 5:34 PM
zura bakuradze
zura bakuradze - avatar
+ 9
Perhaps something like count = -9 while count < 10: print(10-abs(count)) count += 1
16th Nov 2017, 6:34 AM
Ace
Ace - avatar
+ 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
16th Nov 2017, 6:11 AM
Ace
Ace - avatar
+ 6
@Daniel I got that as an interview question years ago and that was the only thing that came to mind as a solution 😂
16th Nov 2017, 6:11 PM
Ace
Ace - avatar
+ 4
What is your question ?
16th Nov 2017, 6:10 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 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"
16th Nov 2017, 6:26 AM
zura bakuradze
zura bakuradze - avatar
+ 1
ace good but i need using "while"
16th Nov 2017, 6:27 AM
zura bakuradze
zura bakuradze - avatar
+ 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
16th Nov 2017, 6:35 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
https://code.sololearn.com/cKbl020vre2P/?ref=app Well, when I wrote my last post I thought in that solution ;-)
16th Nov 2017, 1:19 PM
Daniel
Daniel - avatar
+ 1
Ace I didnt checked your code but is better than mine for height ;-)
16th Nov 2017, 1:23 PM
Daniel
Daniel - avatar
16th Nov 2017, 6:13 AM
Daniel
Daniel - avatar
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
16th Nov 2017, 12:34 PM
Daniel
Daniel - avatar