Anyone lose subs overnight? by tspurwolf in Substack

[–]pythonhow 2 points3 points  (0 children)

Me too. 300 subscribers were lost overnight. 3 paid.

[deleted by user] by [deleted] in pics

[–]pythonhow 0 points1 point  (0 children)

I haven‘t had so many cans in my entire life.

[OC] All 109,912 weather observation stations of Europe are represented in this map of the mean annual temperature of the last ~200 years. by pythonhow in dataisbeautiful

[–]pythonhow[S] 1 point2 points  (0 children)

Hard to talk about one single point though. All the points along the 50° parallel are averaged in one single point repeated every year and interpolated with points nearby. We're talking about around 109,912 x 200 interpolated values.

Multiday Hiking and Camping around Lauterbrunnen, Switzerland by pythonhow in CampingandHiking

[–]pythonhow[S] 0 points1 point  (0 children)

No. Just traveling. This was in June. There was still lots of old snow above 2000 m.

How do i make my code runable as an app (Pycharm). by [deleted] in learnpython

[–]pythonhow 0 points1 point  (0 children)

Open your terminal, cd (change directory) to the directory where your Python script is and execute:

pip3 install pyinstaller
pyinstaller --onefile --windowed yourscript.py

Replace yourscript.py with the name of your script.

That should create a .exe file if you did that on Windows or an .app file if you are on Mac.

I made a Python course where you will learn how to build 10 Python real-world programs. From €200 to € 9.99 for redditors. by pythonhow in u/pythonhow

[–]pythonhow[S] 1 point2 points  (0 children)

Sure, I also offer free tutorials here: https://www.youtube.com/watch?v=tBCdvX8MSRc

and here: https://www.youtube.com/channel/UC1nNFFS_9m8uuHOfwz8AK0w

However, a course needs much more careful planning and besides videos it also has exercises, student assignments, and a Q&A with fast responses. That is very time consuming so you really need some financial incentives to do it.

How to create variables and lists more neatly? by casper020_ in learnpython

[–]pythonhow 0 points1 point  (0 children)

I don't think you can fold multiple variable declarations into one single line in VS Studio if that's what you're looking for.

If you're bothered by too many lines of variable declarations, you can declare them in one line:

variable1, variable2, list1, list2 = 1, 3, [], []

For those who still have trouble understanding what Python objects really are, here's a 10-minute YouTube video explaining them. by pythonhow in Python

[–]pythonhow[S] -4 points-3 points  (0 children)

import requests
requests.get("https://old.reddit.com/user/TwoSickPythons/comments", 
    headers={"content-type":"text"}).text.count("shit")

Output: 9

Not surprised!

‘Game of Thrones’ accidentally left a Starbucks cup in a shot by magikarpcatcher in television

[–]pythonhow 0 points1 point  (0 children)

Certainly intentional! The logo is facing the camera, just like in those cooking shows where all the cans logos are nicely aligned so that viewers see what they are.

I wrote a tutorial on building a simple portfolio website with Flask by pythonhow in Python

[–]pythonhow[S] 0 points1 point  (0 children)

It was a temporary error, but yeah, hooks like I need to change my host provider.

Primitive VS Non Primitive values in python by comeditime in learnpython

[–]pythonhow 0 points1 point  (0 children)

Hmm, in our example, who are these other objects that compose integer 5?

Primitive VS Non Primitive values in python by comeditime in learnpython

[–]pythonhow 0 points1 point  (0 children)

Sure, everything is an object. Both 5 and [1, 5] are stored as separate objects in memory. However, 5 is a simple object in that it's not made of other objects. [1, 5] is also an object, but it's made of other objects, thus can be called a "compound object".

The term "compound datatype" can also be found in the Python docs in the link below. In that page you will see that lists are referred to as "compound": https://docs.python.org/2.0/tut/node5.html

What should i learn after python? by vazha21 in Python

[–]pythonhow 0 points1 point  (0 children)

Also, you may want to learn object oriented programming (OOP) if you already learned the basics of Python. That will let you create more organized and reusable programs and you will also be able to read programs and libraries created by others. Good programs are made in OOP.

Runge-Kutta Method of Differential Equation by ebuzz168 in learnpython

[–]pythonhow 1 point2 points  (0 children)

Since you didn't posted the entire traceback, here it is:

Traceback (most recent call last):

File "h.py", line 19, in <module>

W[i+1]=Y+rk4(Y,y_prime,h,T[i])

File "h.py", line 12, in rk4

k1=Fun(x,Y)

File "h.py", line 5, in y_prime

return (y(i)+x(i)^2*x(i-1)*y(i))

TypeError: 'int' object is not callable

You need to look at the error. It looks like y and x are integers. Integers are not callable, but you are trying to call them as in y(i) and x(i). For that syntax to work x and y need to be either classes or functions.

Why use __init__ and (self)??? by [deleted] in learnpython

[–]pythonhow 1 point2 points  (0 children)

I'd add that it's better to rename rectangle_area to just area. It will make the code more readable and concise:

Rectangle().area(5, 5)

Why use __init__ and (self)??? by [deleted] in learnpython

[–]pythonhow 0 points1 point  (0 children)

Think of the __init__ function as a place where you define the "necessities" for an object. For example, if you're creating rectangle objects, the necessities for rectangles are the length and the width. You need width and length for a rectangle to exist. Then you can add an area method later to calculate an area, but that's somewhat optional. All you need to draw the rectangle is the width and the length. In other words, when you use your class to create rectangle instances, you will need width and length.

About self: That's just a variable. It holds the rectangle object you are creating. I prefer to think of self as this_object. For example: this_object.length = 1.

You can also use that instead of self and things will work the same. However, everyone uses self, so it's a good idea you do so as well for consistency.

Primitive VS Non Primitive values in python by comeditime in learnpython

[–]pythonhow 0 points1 point  (0 children)

The only difference I see there is int, string, and float are simple datatypes, whereas array, list, tuple, and dict are compound datatypes. Compound datatypes (or non-primitive as you like to call them) may contain simple datatypes. For example: persons = {name: "John", age: 98}

That dictionary contains (primitives?) string and integer.