Jul 17, 2024
python
to start, can execute single lines of codea = 6
print(a)
a = 'hello'
, print(a)
def
keyword
def main(): print('Hello')
import
keyword
import sys
, print(sys.argv)
sys.argv
python hello.py
./hello.py
(with execute permissions){ }
def hello(name):
print('Hello', name)
==
if name == 'Alice': print('Hi Alice')
and
, or
, not
'hello'
, "world"
len(string)
string.lower()
string.find('sub')
a + b
"%s %d" % ('hello', 42)
string[index]
string[start:end]
a[1:4]
gets substring from index 1 to 3a[1:]
, a[:3]
a[-3:]
sys
, os
, etc.
import module_name
module.function()
dir()
and help()
functionsday1/
directorystring1.py
(basic string operations)
string2.py
-tt
flag to avoid mixing)