the-magnificents / 04-02-2021-Carpentry-for-HGIS

A carpentry workshop focused on Digital Humanities audience that works with Geospatial Data.
Other
2 stars 3 forks source link

04-02-2021-Carpentry-for-HGIS/01_Day_1_Unix_Shell/excercises/B2_Exercise #51

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Variables, values, inputs, outputs — Python essentials for GIS learners

https://the-magnificents.github.io/04-02-2021-Carpentry-for-HGIS/01_Day_1_Unix_Shell/excercises/B2_Exercise.html

jurra commented 3 years ago

I finished this exercise

jurra commented 3 years ago

An example of how to write code blocks

name = "Jose"
ThoTUM86 commented 3 years ago

I thought that it is always the case that you had to define variables... However in this example you first write/use variables before they are defined.

jurra commented 3 years ago

Maybe you are confusing def with variables def is to define functions. If you look at this piece of code:

C = 1000000
I = 500000
G = 800000
X = 100000
M = 2000000
Y = C + I + G + (X - M)

Variables have been declared and values have been assigned.

yvanmil commented 3 years ago

The first code is more Explicit and more Simple than the second.

cforgaci commented 3 years ago

Some reasons why using a function is better:

I did not get that line about the Dutch :)

communisker commented 3 years ago

The Zen of Python Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than right now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!

jurra commented 3 years ago

I also didnt get the line about the dutch :) maybe the dutch can explain us :D

communisker commented 3 years ago

But I found that C = 1000000 I = 500000 G = 800000 X = 100000 M = 2000000 Y = C + I + G + (X - M) is also beautiful

MertenNefs commented 3 years ago

the function makes it easier to replicate the process for more countries

MertenNefs commented 3 years ago

We Dutch seem to allow only one interpretation or option, according to the non-Dutch;)