Weird interaction with using variables as arguments in a method call [closed] - python

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
Im wondering if somebody could please explain to me why does the left side not work but right side does? Why does assigning the radiuses to variables first produce the wrong calculation in the end?

Look at line 9 of each of the two codes you posted. On the left side, you are doing 26 / 2, whereas on the right side you do 36 / 2 …

Related

How can I use several different types inputs together? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 days ago.
Improve this question
multi inputs in python
write a program to take X and Y as input and out put the string x ,repeated y times.
sample input
hi
3
sample output
hi hi hi

I want to print the 3rd highest value along with the 'Id' as the pic [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 months ago.
Improve this question
From here I want to print the 3rd highest value along with the 'Id'. A help would be appreciated
Most_Calori_Burner.nlargest(3)
TRy this,
df.groupby('Id')['Calories'].sum().sort_values(ascending=False).reset_index().iloc[2]
Sort your dataframe in descending order
Reset index and take 3rd value.

Python Linear regression line error. how do i keep a straight line? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
For the above image, the regression lines are scribbled around and i don't know why? any help would be great.
I believe the issue here is that you are passing in data['size'], which is not sorted and goes between a value on the left and then to the right. The plt.plot always connects points, which is why you get squiggly line back and forth.
Now if this is a simple y = a + bx then I would recommend that you pass in an x input (e.g., x_range = [min(data['size']), max(data['size']) that is the minimum and maximum of data['size']. Then define yhat_no, yhat_yes, and yhat accordingly with x_range.
However, I see that you have a dependence data['year'], so the expectation of a single linear line will not happen.

How to calculate this mathematical expression in python? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I wanted to calculate this mathematical expression in python3:
Xi = (70 + 1344736401384689745317259585614247891453883777111/315)% 115792089210356248762697446949407573529996955224135760342422259061068512044369
But I'm getting this wrong result: 4.2690044488402846e+45 . Is there something wrong in the expression? how can I fix it to give me the right result?
I think you might be confused because it is showing scientific notation? '{}'.format() should help in that case.
Xi = (70 + 1344736401384689745317259585614247891453883777111/315)% 115792089210356248762697446949407573529996955224135760342422259061068512044369
print('{0:f}'.format(Xi))

save scale data and recall data back into scale [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to create a code that will take 24 scale values and save them in a txt. file, i then want to be able to recall these values and put them back into the 24 scales. can someone point me in the right direction.
Thanks
First read this :
http://docs.python.org/2/library/stdtypes.html#bltin-file-objects
then write some code and come back with concrete questions if necessary.

Categories

Resources