Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
количество 1 и 0 в последовательности чисел до n
#python 3.5.2 print ("Hello, world!") n = int(input('Введите число:')) print() s0,s1, k = 0,0,0 for k in range (n+1): i = k while i > 0: if i % 2 == 0: s0+=1 else: s1+=1 i = i // 2 print ('k=', k,'s1=',s1, 's0=', s0) print ('For n=', n, 'there are', s0, '"0"', 'and', s1, '"1"') print ('|"1" - "0"|=', abs(s0-s1))
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Lesson 6 part 3
denemeler
binary
static
My cousin asked for this will never forgive her
Hello
Урок 4 задача 4: решить в целых числах уравнение ax=b (python)
Print lists separated by comma
Single and double qoute
regu
stackse - search stackoverflow differently
Please log in to post a comment.