python study-get started

1. download python fro https://www.python.org/

2. click on the package to install

3. check. python in terminater

 >python --version
Python 2.7.16

4.  when using python3, you can input python3

>python3
Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print("hell")
hell
>>>

 

5. create file hello.py with content

print("Hello, World!")

6. execute the file hello.py

>python3 hello.py

7. Python uses indentation to indicate a block of code.

The number of spaces is up to you as a programmer, but it has to be at least one.

if 5 > 2:
    print("Five is greater than two!") 
if 5 > 2:
        print("Five is greater than two!") 

You have to use the same number of spaces in the same block of code, otherwise Python will give you an error:

if 5 > 2:
    print("Five is greater than two!")
        print("Five is greater than two!")

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值