Posts

Python for beginers

python --version print("Hello, World!") C:\Users\Your Name>python helloworld.py exit() if 5 > 2:   print("Five is greater than two!")   x = 5 y = "Hello, World!" Comment # """ dsdjask """ x = 5 y = "John" print(x) print(y) Remember that variable names are case-sensitive x, y, z = "Orange", "Banana", "Cherry" print(x) print(y) print(z) x = y = z = "Orange" print(x) print(y) print(z) x = "awesome" print("Python is " + x) x = "Python is " y = "awesome" z =  x + y print(z) x = 5 y = 10 print(x + y) Python Numbers There are three numeric types in Python: int float complex >> x^2 = -a >> a+bi x = 1    # int y = 2.8  # float z = 1j   # complex x = 3+5j y = 5j z = -5j x = 1 # int y = 2.8 # float z = 1j # complex #convert from int to float: a = float(x