一起学python-语法

Posted sheilali1234

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了一起学python-语法相关的知识,希望对你有一定的参考价值。

1、print 输出

2、定义变量:就是给变量赋一个值 name =‘haha‘ print (name)

3、注释代码:# 注释快捷键:Ctrl +/

4、单双引号:

如果字符串里面有单引号,外面就用双引号;其他单双都行;

例如:Let‘s go,you are so "beautiful" 可以这样做:‘‘‘ Let‘s go,you are so "beautiful" ‘‘‘

三个单引号还可以注释:例如, ‘‘‘ hdhfjdhfjdhfjdhfjdhfjdhfjdhfjd ‘‘‘

5.input ("请输入你的名字")

6.符号:> < >= <= == !=

7.字符类型转换,string 转 int

score = input ("请输入你的成绩:")
score = int(score)

 

以上是关于一起学python-语法的主要内容,如果未能解决你的问题,请参考以下文章