diff --git a/lectures/week1.html b/lectures/week1.html index b772189..72d5c1b 100644 --- a/lectures/week1.html +++ b/lectures/week1.html @@ -1,1176 +1,1177 @@
Rapid changes
Large problems
This is the standard of most Version control systems such as GIT
git status
git log
git branch
git checkout stable-branch
git push origin master
git pull origin master
git remote -v
git remote add/remove
git log
git status
git checkout
git add file.cc
git rm file.cc
git mv file.cc
git commit -m "nice message" file.cc
git push remote_name branch_name
git push origin master
git diff
git diff revision_hash
git help whatever_command
What is c4science ?
C4 Science is a co-creation platform, curation and code sharing. This platform includes:
Connect to c4science
The recommended way to connect to the c4science server (and actually any distant linux machine) is through the SSH protocol:
#my super comment
print(10)
a = 10
b = 10.
type(a)
type(b)
a = "1.2"
print(a)
a_int = int(a)
print(a_int)
a_float = float(a)
print(a_float)
a = list()
a.append(2)
print(a)
a = [2,4,5]
a.append([2,4,5])
print(a)
a += [2,4,5]
b = [1,2]*4
print(a[1])
print(a[2])
planet = dict()
planet["name"] = "mars"
planet["radius"] = 1.2
planet["mass"] = 0.4
print(planet)
block_start:
#start of the block
instruction1
instruction2
instruction3
#end of the block
a = 1
if not a == 0:
print("a != 0")
else:
print("a == 0")
for i in range(0,10):
print(i)
for i in mylist:
print(i)
def foo(arg1, arg2, arg3):
...
some_code
...
f = open("my_super_filename.csv", 'w')
f.write("#X Y Z VX VY VZ FX FY FZ mass radius name\n")
+f.close()
f = open("my_super_filename.csv", 'r')
for line in f:
entries = line.split()
print(entries)
# request to use another module
import sys
#my_module.py
def foo(arg):
return arg+1
I can call this function from another file with
import my_module
res = my_module.foo(10)
print(res)
python3 exe.py arg1 arg2 arg3
import sys
# the arguments are stored in the list sys.argv
# for instance you can print it with
print(sys.argv)