On 10/05/14 07:35, 1 2 wrote:
In the result it shows "s= 8" pls tell me how to remove the blank?
s,t,n = 0,0,1
while t <= s:
s,t,n = s+2,t+n,n+1
else:
print('s=',s,n)
Assuming you are using Python version 3 you need to specify the sep
option to print:
print('s=',s,n,sep='')
>>> help(print)
Help on built-in function print in module builtins:
print(...)
print(value, ..., sep=' ', end='\n', file=sys.stdout)
Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
(END)
hth
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor