workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
look up the `bin()` function
2018-01-29T20:33:04.000183
Garrett
pythondev_help_Garrett_2018-01-29T20:33:04.000183
1,517,257,984.000183
31,924
pythondev
help
is the built in function bin(_
2018-01-29T20:33:06.000109
Kelsey
pythondev_help_Kelsey_2018-01-29T20:33:06.000109
1,517,257,986.000109
31,925
pythondev
help
?
2018-01-29T20:33:06.000394
Kelsey
pythondev_help_Kelsey_2018-01-29T20:33:06.000394
1,517,257,986.000394
31,926
pythondev
help
yep
2018-01-29T20:33:27.000059
Garrett
pythondev_help_Garrett_2018-01-29T20:33:27.000059
1,517,258,007.000059
31,927
pythondev
help
```bin(3) Out[2]: '0b11'```
2018-01-29T20:33:34.000038
Kelsey
pythondev_help_Kelsey_2018-01-29T20:33:34.000038
1,517,258,014.000038
31,928
pythondev
help
you have some cruft there, though. you don't need that `0b` part
2018-01-29T20:33:49.000161
Garrett
pythondev_help_Garrett_2018-01-29T20:33:49.000161
1,517,258,029.000161
31,929
pythondev
help
``` bin(7) Out[3]: '0b111'```
2018-01-29T20:33:50.000033
Kelsey
pythondev_help_Kelsey_2018-01-29T20:33:50.000033
1,517,258,030.000033
31,930
pythondev
help
ah
2018-01-29T20:33:57.000202
Kelsey
pythondev_help_Kelsey_2018-01-29T20:33:57.000202
1,517,258,037.000202
31,931
pythondev
help
do you know how to cut characters off of a string using a slice?
2018-01-29T20:34:13.000178
Garrett
pythondev_help_Garrett_2018-01-29T20:34:13.000178
1,517,258,053.000178
31,932
pythondev
help
yeap
2018-01-29T20:34:16.000364
Kelsey
pythondev_help_Kelsey_2018-01-29T20:34:16.000364
1,517,258,056.000364
31,933
pythondev
help
alright. so you need the binary representation of `var`. maybe we'll call that `bin_var`?
2018-01-29T20:34:39.000229
Garrett
pythondev_help_Garrett_2018-01-29T20:34:39.000229
1,517,258,079.000229
31,934
pythondev
help
`bin_var = `?
2018-01-29T20:34:47.000344
Garrett
pythondev_help_Garrett_2018-01-29T20:34:47.000344
1,517,258,087.000344
31,935
pythondev
help
so its alwasy going to be the first 2 strings that are fluff it looks like
2018-01-29T20:34:48.000161
Kelsey
pythondev_help_Kelsey_2018-01-29T20:34:48.000161
1,517,258,088.000161
31,936
pythondev
help
yep
2018-01-29T20:35:14.000013
Garrett
pythondev_help_Garrett_2018-01-29T20:35:14.000013
1,517,258,114.000013
31,937
pythondev
help
for now, i just went with this `bin(7)[2:]`
2018-01-29T20:35:38.000189
Kelsey
pythondev_help_Kelsey_2018-01-29T20:35:38.000189
1,517,258,138.000189
31,938
pythondev
help
just for the time being
2018-01-29T20:35:45.000076
Kelsey
pythondev_help_Kelsey_2018-01-29T20:35:45.000076
1,517,258,145.000076
31,939
pythondev
help
since the first 2 chars are always unnecessary.
2018-01-29T20:36:01.000139
Kelsey
pythondev_help_Kelsey_2018-01-29T20:36:01.000139
1,517,258,161.000139
31,940
pythondev
help
right. that gives you a string like `'111'`
2018-01-29T20:36:09.000308
Garrett
pythondev_help_Garrett_2018-01-29T20:36:09.000308
1,517,258,169.000308
31,941
pythondev
help
correct
2018-01-29T20:36:14.000139
Kelsey
pythondev_help_Kelsey_2018-01-29T20:36:14.000139
1,517,258,174.000139
31,942
pythondev
help
ok
2018-01-29T20:36:15.000157
Kelsey
pythondev_help_Kelsey_2018-01-29T20:36:15.000157
1,517,258,175.000157
31,943
pythondev
help
go with `bin(9)` for now so it's more interesting
2018-01-29T20:36:26.000021
Garrett
pythondev_help_Garrett_2018-01-29T20:36:26.000021
1,517,258,186.000021
31,944
pythondev
help
that should be `1001`, if my binary math is correct
2018-01-29T20:36:33.000380
Garrett
pythondev_help_Garrett_2018-01-29T20:36:33.000380
1,517,258,193.00038
31,945
pythondev
help
thats correct
2018-01-29T20:36:50.000180
Kelsey
pythondev_help_Kelsey_2018-01-29T20:36:50.000180
1,517,258,210.00018
31,946
pythondev
help
now, you need to count everything in that string that's a 1
2018-01-29T20:36:53.000174
Garrett
pythondev_help_Garrett_2018-01-29T20:36:53.000174
1,517,258,213.000174
31,947
pythondev
help
i can think of a couple of ways of doing that. what can you think of for it?
2018-01-29T20:37:12.000174
Garrett
pythondev_help_Garrett_2018-01-29T20:37:12.000174
1,517,258,232.000174
31,948
pythondev
help
(or, more accurately, everything that's a `'1'`)
2018-01-29T20:37:25.000367
Garrett
pythondev_help_Garrett_2018-01-29T20:37:25.000367
1,517,258,245.000367
31,949
pythondev
help
.count?
2018-01-29T20:37:35.000182
Kelsey
pythondev_help_Kelsey_2018-01-29T20:37:35.000182
1,517,258,255.000182
31,950
pythondev
help
.count()
2018-01-29T20:37:39.000190
Kelsey
pythondev_help_Kelsey_2018-01-29T20:37:39.000190
1,517,258,259.00019
31,951
pythondev
help
should work
2018-01-29T20:37:41.000392
Kelsey
pythondev_help_Kelsey_2018-01-29T20:37:41.000392
1,517,258,261.000392
31,952
pythondev
help
?
2018-01-29T20:37:43.000032
Kelsey
pythondev_help_Kelsey_2018-01-29T20:37:43.000032
1,517,258,263.000032
31,953
pythondev
help
no?
2018-01-29T20:37:44.000037
Kelsey
pythondev_help_Kelsey_2018-01-29T20:37:44.000037
1,517,258,264.000037
31,954
pythondev
help
``` bin(9)[2:].count('1') Out[10]: 2```
2018-01-29T20:38:04.000227
Kelsey
pythondev_help_Kelsey_2018-01-29T20:38:04.000227
1,517,258,284.000227
31,955
pythondev
help
uh, `str.count()` exists
2018-01-29T20:38:07.000249
Garrett
pythondev_help_Garrett_2018-01-29T20:38:07.000249
1,517,258,287.000249
31,956
pythondev
help
that looks right to me
2018-01-29T20:38:14.000149
Garrett
pythondev_help_Garrett_2018-01-29T20:38:14.000149
1,517,258,294.000149
31,957
pythondev
help
yea looks like it works
2018-01-29T20:38:20.000076
Kelsey
pythondev_help_Kelsey_2018-01-29T20:38:20.000076
1,517,258,300.000076
31,958
pythondev
help
so you just did it. you solved the problem :sparkling_heart:
2018-01-29T20:38:41.000356
Garrett
pythondev_help_Garrett_2018-01-29T20:38:41.000356
1,517,258,321.000356
31,959
pythondev
help
lol, im confused,
2018-01-29T20:38:53.000323
Kelsey
pythondev_help_Kelsey_2018-01-29T20:38:53.000323
1,517,258,333.000323
31,960
pythondev
help
ok, what's confusing?
2018-01-29T20:39:11.000133
Garrett
pythondev_help_Garrett_2018-01-29T20:39:11.000133
1,517,258,351.000133
31,961
pythondev
help
the last code i worte im here
2018-01-29T20:39:13.000058
Kelsey
pythondev_help_Kelsey_2018-01-29T20:39:13.000058
1,517,258,353.000058
31,962
pythondev
help
```def solution(A, B): if A >= 0 and B >= 0: var = A * B ```
2018-01-29T20:39:20.000149
Kelsey
pythondev_help_Kelsey_2018-01-29T20:39:20.000149
1,517,258,360.000149
31,963
pythondev
help
right
2018-01-29T20:39:37.000011
Garrett
pythondev_help_Garrett_2018-01-29T20:39:37.000011
1,517,258,377.000011
31,964
pythondev
help
so `var` is, say, `21`. what's the next step that we did?
2018-01-29T20:39:59.000044
Garrett
pythondev_help_Garrett_2018-01-29T20:39:59.000044
1,517,258,399.000044
31,965
pythondev
help
`bin(var)[2:].count('1')`
2018-01-29T20:40:18.000027
Kelsey
pythondev_help_Kelsey_2018-01-29T20:40:18.000027
1,517,258,418.000027
31,966
pythondev
help
right. probably want to stash that in a variable
2018-01-29T20:40:40.000121
Garrett
pythondev_help_Garrett_2018-01-29T20:40:40.000121
1,517,258,440.000121
31,967
pythondev
help
now what?
2018-01-29T20:40:45.000284
Garrett
pythondev_help_Garrett_2018-01-29T20:40:45.000284
1,517,258,445.000284
31,968
pythondev
help
```def solution(A, B): if A >= 0 and B >= 0: var = A * B bin_var = bin(var)[2:].count('1')```
2018-01-29T20:41:22.000077
Kelsey
pythondev_help_Kelsey_2018-01-29T20:41:22.000077
1,517,258,482.000077
31,969
pythondev
help
so here
2018-01-29T20:41:25.000149
Kelsey
pythondev_help_Kelsey_2018-01-29T20:41:25.000149
1,517,258,485.000149
31,970
pythondev
help
now
2018-01-29T20:41:26.000164
Kelsey
pythondev_help_Kelsey_2018-01-29T20:41:26.000164
1,517,258,486.000164
31,971
pythondev
help
you've done all the work. your function just needs to return the value
2018-01-29T20:41:55.000077
Garrett
pythondev_help_Garrett_2018-01-29T20:41:55.000077
1,517,258,515.000077
31,972
pythondev
help
so just retun
2018-01-29T20:41:58.000234
Kelsey
pythondev_help_Kelsey_2018-01-29T20:41:58.000234
1,517,258,518.000234
31,973
pythondev
help
bin var?
2018-01-29T20:42:02.000013
Kelsey
pythondev_help_Kelsey_2018-01-29T20:42:02.000013
1,517,258,522.000013
31,974
pythondev
help
than
2018-01-29T20:42:04.000011
Kelsey
pythondev_help_Kelsey_2018-01-29T20:42:04.000011
1,517,258,524.000011
31,975
pythondev
help
right?
2018-01-29T20:42:06.000005
Kelsey
pythondev_help_Kelsey_2018-01-29T20:42:06.000005
1,517,258,526.000005
31,976
pythondev
help
uh huh
2018-01-29T20:42:13.000014
Garrett
pythondev_help_Garrett_2018-01-29T20:42:13.000014
1,517,258,533.000014
31,977
pythondev
help
you can simplify this a lot, too
2018-01-29T20:42:19.000036
Garrett
pythondev_help_Garrett_2018-01-29T20:42:19.000036
1,517,258,539.000036
31,978
pythondev
help
how would u?
2018-01-29T20:42:28.000280
Kelsey
pythondev_help_Kelsey_2018-01-29T20:42:28.000280
1,517,258,548.00028
31,979
pythondev
help
you never use `bin_var`, so you don't have to have it. just `return` everything on the right side of the `=`
2018-01-29T20:42:55.000366
Garrett
pythondev_help_Garrett_2018-01-29T20:42:55.000366
1,517,258,575.000366
31,980
pythondev
help
thats true
2018-01-29T20:43:11.000084
Kelsey
pythondev_help_Kelsey_2018-01-29T20:43:11.000084
1,517,258,591.000084
31,981
pythondev
help
and `var` is really just there to hold the calculation. it's simple, so do it inside the `bin()` call
2018-01-29T20:43:11.000113
Garrett
pythondev_help_Garrett_2018-01-29T20:43:11.000113
1,517,258,591.000113
31,982
pythondev
help
and you're not doing anything with that `if`, so i'd probably drop that
2018-01-29T20:43:25.000153
Garrett
pythondev_help_Garrett_2018-01-29T20:43:25.000153
1,517,258,605.000153
31,983
pythondev
help
if you're worried about bad inputs, maybe an `assert` or something
2018-01-29T20:43:36.000142
Garrett
pythondev_help_Garrett_2018-01-29T20:43:36.000142
1,517,258,616.000142
31,984
pythondev
help
or actually use a `try` and `except` pair and throw a legit error
2018-01-29T20:43:59.000016
Garrett
pythondev_help_Garrett_2018-01-29T20:43:59.000016
1,517,258,639.000016
31,985
pythondev
help
so i'd probably end up with
2018-01-29T20:44:27.000275
Garrett
pythondev_help_Garrett_2018-01-29T20:44:27.000275
1,517,258,667.000275
31,986
pythondev
help
``` def solution(a, b): try: assert isinstance(a, int) and isinstance(b, int) assert a > -1 and b > -1 except AssertionError: raise ValueError("both arguments to solution() must be positive integers") else: return bin(a*b)[2:].count('1') ```
2018-01-29T20:44:28.000235
Garrett
pythondev_help_Garrett_2018-01-29T20:44:28.000235
1,517,258,668.000235
31,987
pythondev
help
oh thats pretty slick
2018-01-29T20:47:15.000069
Kelsey
pythondev_help_Kelsey_2018-01-29T20:47:15.000069
1,517,258,835.000069
31,988
pythondev
help
<@Kelsey> Looking at your function you'll need to convert the variable to a string to use `.count()`
2018-01-29T20:47:19.000072
Porsha
pythondev_help_Porsha_2018-01-29T20:47:19.000072
1,517,258,839.000072
31,989
pythondev
help
looks like the bin() method return a string and takes in int
2018-01-29T20:47:37.000020
Kelsey
pythondev_help_Kelsey_2018-01-29T20:47:37.000020
1,517,258,857.00002
31,990
pythondev
help
Think Kenneth mentioned that
2018-01-29T20:47:43.000233
Porsha
pythondev_help_Porsha_2018-01-29T20:47:43.000233
1,517,258,863.000233
31,991
pythondev
help
<@Porsha> `bin` returns a string
2018-01-29T20:47:45.000117
Garrett
pythondev_help_Garrett_2018-01-29T20:47:45.000117
1,517,258,865.000117
31,992
pythondev
help
and a slice of a string is still a string
2018-01-29T20:47:59.000110
Garrett
pythondev_help_Garrett_2018-01-29T20:47:59.000110
1,517,258,879.00011
31,993
pythondev
help
oh right, cool
2018-01-29T20:48:00.000063
Porsha
pythondev_help_Porsha_2018-01-29T20:48:00.000063
1,517,258,880.000063
31,994
pythondev
help
yeap what Kenneth just said.
2018-01-29T20:48:05.000354
Kelsey
pythondev_help_Kelsey_2018-01-29T20:48:05.000354
1,517,258,885.000354
31,995
pythondev
help
_very_ handy to remember that a slice is always the same data type as the thing you sliced
2018-01-29T20:48:32.000189
Garrett
pythondev_help_Garrett_2018-01-29T20:48:32.000189
1,517,258,912.000189
31,996
pythondev
help
unlike index access where the type will likely change
2018-01-29T20:48:43.000235
Garrett
pythondev_help_Garrett_2018-01-29T20:48:43.000235
1,517,258,923.000235
31,997
pythondev
help
that difference bites a lot of people
2018-01-29T20:50:12.000038
Garrett
pythondev_help_Garrett_2018-01-29T20:50:12.000038
1,517,259,012.000038
31,998
pythondev
help
Derp monent :face_with_rolling_eyes:
2018-01-29T20:51:26.000133
Porsha
pythondev_help_Porsha_2018-01-29T20:51:26.000133
1,517,259,086.000133
31,999
pythondev
help
Kenneth thanks for the pairing, that was phenomenal
2018-01-29T20:51:45.000261
Kelsey
pythondev_help_Kelsey_2018-01-29T20:51:45.000261
1,517,259,105.000261
32,000
pythondev
help
<@Kelsey> of course. glad to help
2018-01-29T20:52:13.000038
Garrett
pythondev_help_Garrett_2018-01-29T20:52:13.000038
1,517,259,133.000038
32,001
pythondev
help
just taking some coding challenges, for the hell of it in python 3.6
2018-01-29T20:52:33.000269
Kelsey
pythondev_help_Kelsey_2018-01-29T20:52:33.000269
1,517,259,153.000269
32,002
pythondev
help
<@Garrett> :taco: Always teaching :ok_hand:
2018-01-29T20:52:52.000219
Porsha
pythondev_help_Porsha_2018-01-29T20:52:52.000219
1,517,259,172.000219
32,003
pythondev
help
lol. less than i'd like nowadays
2018-01-29T20:53:07.000171
Garrett
pythondev_help_Garrett_2018-01-29T20:53:07.000171
1,517,259,187.000171
32,004
pythondev
help
need to do something about that
2018-01-29T20:53:18.000256
Garrett
pythondev_help_Garrett_2018-01-29T20:53:18.000256
1,517,259,198.000256
32,005
pythondev
help
You not thought about some solo projects?
2018-01-29T20:53:33.000053
Porsha
pythondev_help_Porsha_2018-01-29T20:53:33.000053
1,517,259,213.000053
32,006
pythondev
help
....not saying anything too concrete at the moment :smile:
2018-01-29T20:53:55.000053
Garrett
pythondev_help_Garrett_2018-01-29T20:53:55.000053
1,517,259,235.000053
32,007
pythondev
help
oooooh :sunglasses:
2018-01-29T20:54:05.000191
Porsha
pythondev_help_Porsha_2018-01-29T20:54:05.000191
1,517,259,245.000191
32,008
pythondev
help
Make sure you let us know if you do decide to
2018-01-29T20:54:36.000262
Porsha
pythondev_help_Porsha_2018-01-29T20:54:36.000262
1,517,259,276.000262
32,009
pythondev
help
oh, i'll be very obnoxious about it
2018-01-29T20:54:57.000206
Garrett
pythondev_help_Garrett_2018-01-29T20:54:57.000206
1,517,259,297.000206
32,010
pythondev
help
haha - <#C3GFPUBGF|shameless_plug> awaits
2018-01-29T20:55:23.000289
Porsha
pythondev_help_Porsha_2018-01-29T20:55:23.000289
1,517,259,323.000289
32,011
pythondev
help
anyone down to do another one lol - ```given a non empty string S consisting of N characters, returns the length of its longest substring that is a valid password. If there is no such substring, your function should return -1```
2018-01-29T20:56:12.000172
Kelsey
pythondev_help_Kelsey_2018-01-29T20:56:12.000172
1,517,259,372.000172
32,012
pythondev
help
what's "a valid password"?
2018-01-29T20:56:28.000257
Garrett
pythondev_help_Garrett_2018-01-29T20:56:28.000257
1,517,259,388.000257
32,013
pythondev
help
qood question.
2018-01-29T20:56:43.000072
Kelsey
pythondev_help_Kelsey_2018-01-29T20:56:43.000072
1,517,259,403.000072
32,014
pythondev
help
it contains at least one uppercase character
2018-01-29T20:57:01.000245
Kelsey
pythondev_help_Kelsey_2018-01-29T20:57:01.000245
1,517,259,421.000245
32,015
pythondev
help
and it cannot contain digits
2018-01-29T20:57:10.000343
Kelsey
pythondev_help_Kelsey_2018-01-29T20:57:10.000343
1,517,259,430.000343
32,016
pythondev
help
thats all
2018-01-29T20:57:12.000231
Kelsey
pythondev_help_Kelsey_2018-01-29T20:57:12.000231
1,517,259,432.000231
32,017
pythondev
help
unfortunately i have to run a kid to a class but i'm sure you can get it. break it down into smaller problems
2018-01-29T20:57:56.000046
Garrett
pythondev_help_Garrett_2018-01-29T20:57:56.000046
1,517,259,476.000046
32,018
pythondev
help
yea not a problem :slightly_smiling_face:
2018-01-29T20:58:06.000288
Kelsey
pythondev_help_Kelsey_2018-01-29T20:58:06.000288
1,517,259,486.000288
32,019
pythondev
help
enjoy!
2018-01-29T20:58:10.000162
Kelsey
pythondev_help_Kelsey_2018-01-29T20:58:10.000162
1,517,259,490.000162
32,020
pythondev
help
thanks
2018-01-29T20:58:12.000234
Kelsey
pythondev_help_Kelsey_2018-01-29T20:58:12.000234
1,517,259,492.000234
32,021
pythondev
help
You'll find some useful built in types for exactly this kind of thing in the python docs <https://docs.python.org/3/library/stdtypes.html>
2018-01-29T20:59:29.000031
Porsha
pythondev_help_Porsha_2018-01-29T20:59:29.000031
1,517,259,569.000031
32,022
pythondev
help
Scroll down to string methods
2018-01-29T21:00:02.000120
Porsha
pythondev_help_Porsha_2018-01-29T21:00:02.000120
1,517,259,602.00012
32,023