Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I am currently following through a book (Python Crash Course), and have just been introduced to the '==' equality operator.
In the book, it shows setting a variable and checking whether it is equal to itself (using ==). See below.
Also tried numerical comparisons and having the same issue as outlined below.
car = "bmw"
car == "bmw"
This is providing no output and PyCharm is telling me 'car == "bmw" has no effect. Book is telling me it should be responding "True" as I am checking the variable which I have literally JUST set.
Try:
car = "bmw"
print(car == "bmw")
Or type your code directly in the console. Just running your script like that won’t produce anything, because you don’t do anything with the comparison.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
In round function what is the use of _100, _104, etc.
I know that round(10.121, 1) will round the value up to 1 decimal place.
But the purpose of _104 is not getting.
I've attached two screenshots for reference.
In IPython, _109 means the output of the 109th cell execution. This implies that while you were running your IPython notebook (through VS Code), at cell execution 109, you received an output of 103. The reason why Bram above can't run print(_109) on his end is that he was either running it in a Python file/interpreter, or executing it in a fresh notebook where he hasn't run 109 cells yet, and thus the variable _109 did not exist.
Check this answer for more information: https://stackoverflow.com/a/27952661/2327379
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I have a dataframe called propertydf.
When I run my code I get a very vague error:
propertydf = propertydf[propertydf['fixed_price'].notna()].copy()
^
SyntaxError: invalid syntax
I checked the code and the dataframe variable has changed color to blue? But not all of them.
I also noticed some other variables are suddenly blue, such as year and date.
I think this is causing the error. How can I fix it?
In the line propertydf['fixed_price'] = fix_price((propertydf.iloc[:,[4]]) you open two parenthesis but only close one (It's above the line that throws the error).
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
It's saying there's a syntax error (seems simple enough) but I've double-checked the video (and my brain). I don't see why it would be saying that.
Been following this tutorial and taking notes to a T (if I need to include more code let me know).
I defined "run_test" and am entering the parameters in question. Help?
You have extra opening parenthesis before ‘str(len(...))’
There should be a closing brackets for str in print statement ')' , add this and your program will work
If i am not wrong, you haven't defined the list of questions yet. If you have defined your list of questions it is probably a typing error in your code. If there is the full code under the tutorial you are doing then i would compare my code to the code from the tutorial.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I just stumbled upon this snippet
if len(x_) >= no_peaks:
what does that mean?
it resembles an and from other languages but I cannot quite make sense of it
This is the result of a badly-configured HTML escaping tool which somehow managed to escape the code twice. It's supposed to be >=.
This appears to be a syntax error.
To answer your question however, the & character performs a bitwise and operation if used alone as seen in the documentation here.
If used in conjunction with an equal sign it performs the same operation as part of an augmented assignment expression.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
Today I was playing with a Python dict and I found something weird:
>>> print {}.get('non-existant-key')
>>> a = {}.get('non-existant-key')
>>> print a
None
>>>
Why does the repl print an empty space with the first print and "None" after taking the step of storing the value in the variable a? The thing it tries to print is the same in both cases, so why is there be a difference?
Okay, turns out it wasn't the behaviour of the Python repl, but the (for the rest excellent) bpython repl which I always use. I didn't realise I was using bpython instead of the vanilla python when I was testing this.
In the regular pyton repl it all works as expected. I'll file a bug with bpython about this.