That passed the test! Thank you!
- 2 Posts
- 11 Comments
It’s for CS50P which uses a customized VS Code. It has an automated code checker which I ran when I was done.
outputs “Just right!” when guess is correct
timed out while waiting for program to exit
Was using tabs but I went through it to make sure and seemed to be ok.
milon@lemm.eeOPto Python@programming.dev•Why can't I use the '|' bitwise operator in this statement?3·2 months agoThank you for the thorough explanation. It makes sense to me why I had the error that I did. I’ll keep this in mind next time when I consider using a bitwise operator.
milon@lemm.eeOPto Python@programming.dev•Why can't I use the '|' bitwise operator in this statement?7·2 months agoThank you for the reply. It seems bitwise operators are somewhat of an advanced concept that I may revisit down the road.
milon@lemm.eeOPto Python@programming.dev•Why can't I use the '|' bitwise operator in this statement?4·2 months agoThanks. I think I understand why I wouldn’t want to use it in this case. But what is an example of where I can use it? This makes me think I should avoid using bitwise operators with integers and keep it to strings only, but I know that’s not true from what I’ve learned.
milon@lemm.eeOPto Python@programming.dev•Why can't I use the '|' bitwise operator in this statement?2·2 months agoThank you. Not sure why in the link the arithmetic in green results in 7.
milon@lemm.eeOPto Python@programming.dev•Why can't I use the '|' bitwise operator in this statement?2·2 months agoThank you for breaking it down.
I’m just now sure when it is appropriate to use ‘|’. If bitwise operators can only be used with integers (and not floats), what’s an example where I can use it.
milon@lemm.eeOPto Python@programming.dev•Why can't I use the '|' bitwise operator in this statement?1·2 months agoYes I did eventually think of that as well but just wanted to understand why ‘|’ wasn’t producing the results I expected.
milon@lemm.eeOPto Python@programming.dev•Why can't I use the '|' bitwise operator in this statement?1·2 months agoI did come across that link but didn’t quite understand it. If looking only at 25 | 10, does the code not run as expected because 25 is 5 digits long and 10 is 4 digits long? Is that what’s meant by “two equivalent length bit designs”?
Also, I can’t tell if 10 | 4 = 7 or 10 | 4 = 14.
The idiom allowed it to pass the checker’s tests! Thanks for your help!