第一次课 课上代码

第一次课内容

 

学习心态及注意事项

信心

谦虚

脚踏实地

多动手

python简介

代码量少,简介,易上手,语法要求不过于严格,

Python 库。

速度慢,

不可加密。

输出、变量、输入

数据类型:整数、浮点数、字符串

 

 

 

>>>

 

>>> print("woshi zhazha")

woshi zhazha

>>> print("我是渣渣")

我是渣渣

>>> print("woshi","zhazha")

woshi zhazha

>>> print(1)

1

>>> print(1.5)

1.5

>>> print(-1)

-1

>>> print(4*5)

20

>>> print("dasdsdas",end="0"))

SyntaxError: invalid syntax

>>> print("dasdsdas",end="0")

dasdsdas0

>>> print('''

*

*

       ***

       ***''')

 

*

*

       ***

       ***

>>> print("两分钟时间,练习")

两分钟时间,练习

>>> print('''

三个引号后,直接回车换行''')

 

三个引号后,直接回车换行

>>> print('注意,括号和引号必须是英文。')

注意,括号和引号必须是英文。

>>> print('单引号双引号都可以')

单引号双引号都可以

>>> print('引号内为字符串')

引号内为字符串

>>> print('dasdadadasdada')

dasdadadasdada

>>> a=10

>>> print(a)

10

>>> print('a')

a

>>> print('a=',a)

a= 10

>>> a=10

>>> b=a

>>> a=5

>>> print(a,b)

5 10

>>> print('装修的来了,大家自己练习一下')

装修的来了,大家自己练习一下

>>> print('python代码简单优雅,让同学们更注重解决问题的方法本身,而不是纠结于语法。相比其他语言,python更加灵活。')

python代码简单优雅,让同学们更注重解决问题的方法本身,而不是纠结于语法。相比其他语言,python更加灵活。

>>> a=5

>>> a=a+5

>>> print(a)

10

>>> print("程序:0个或多个输入;")

程序:0个或多个输入;

>>> print('nvsd'sdf')

      

SyntaxError: invalid syntax

>>> print("fsasfa'fasfas")

fsasfa'fasfas

>>> print('sasf"dsf')

sasf"dsf

>>> print('   \'  ')

   '  

>>> print('\\\nhhh')

\

hhh

>>> input()

111

'111'

>>> a=input()

111

>>> print(a)

111

>>> a=1

>>> b=1.5

>>> c='aaa'

>>> print(a+c)

Traceback (most recent call last):

  File "<pyshell#77>", line 1, in <module>

    print(a+c)

TypeError: unsupported operand type(s) for +: 'int' and 'str'

>>> print(a+b)

2.5

>>> b=int(b)

>>> print(b)

1

>>> print(int(-1))

-1

>>> print(int(-1.5))

-1

>>> print(2//3)

0

>>> print(-3//4)

-1

>>> print(float(1))

1.0

>>> print(fdubib)

Traceback (most recent call last):

  File "<pyshell#86>", line 1, in <module>

    print(fdubib)

NameError: name 'fdubib' is not defined

>>> fdubib=a

>>> print(fdubib)

1

>>> print('dadas\'dfsd')

dadas'dfsd

>>> print('''

fssdfs

sdfasdas''')

 

fssdfs

sdfasdas

>>> print("大家练习一下这部分内容")

大家练习一下这部分内容

>>> a='我'

>>> print(a)

>>> b='是'

>>> print(a+b)

我是

>>> print(4+3)

7

>>> a='4'

>>> b='5'

>>> print(a+b)

45

>>> a=1.5

>>> a=a*a

>>> print(a)

2.25

>>> input()

5

'5'

>>> print('')

 

>>> a=1

>>> a=input('请输入边长')

请输入边长5

>>> print("请输入边长")

请输入边长

>>> a=input()

5

>>> print(a*a)

Traceback (most recent call last):

  File "<pyshell#112>", line 1, in <module>

    print(a*a)

TypeError: can't multiply sequence by non-int of type 'str'

>>> a=int(a)

>>> print(a*a)

25

>>> a=int(input())

5

>>> print(a*a)

25

>>> print(int(input())**2)

5

25

>>> print('a'*10)

aaaaaaaaaa

>>> print('a'*10.0)

Traceback (most recent call last):

  File "<pyshell#119>", line 1, in <module>

    print('a'*10.0)

TypeError: can't multiply sequence by non-int of type 'float'

>>> print('woshi zhazha '*100)

>>> a=int(input('请输入边长'))

请输入边长5

>>> print('面积为',a**2)

面积为 25

>>> print('sdvfsfd')

sdvfsfd

>>> print('''

      *

      **

      ***

      ****

      *****''')

 

      *

      **

      ***

      ****

      *****

>>> print('\n'.join([''.join([('XXXXXXXX'[(x-y)%8]if((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3<=0 else' ')for x in range(-30,30)])for y in range(15,-15,-1)]))

                                                            

                                                            

                                                            

                XXXXXXXXX           XXXXXXXXX               

            XXXXXXXXXXXXXXXXX   XXXXXXXXXXXXXXXXX           

          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX         

         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX        

        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       

        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       

        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       

        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       

        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       

        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       

         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX        

          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX         

          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX         

            XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX           

             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX            

              XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX             

                XXXXXXXXXXXXXXXXXXXXXXXXXXXXX               

                  XXXXXXXXXXXXXXXXXXXXXXXXX                 

                    XXXXXXXXXXXXXXXXXXXXX                   

                       XXXXXXXXXXXXXXX                      

                          XXXXXXXXX                         

                             XXX                            

                              X                             

                                                            

                                                            

                                                            

                                                            

>>> print('\n'.join([' '.join(['%d*%d=%2d'%(y,x,x*y) for y in range(1,x+1)]) for x in range(1,10)]))

1*1= 1

1*2= 2 2*2= 4

1*3= 3 2*3= 6 3*3= 9

1*4= 4 2*4= 8 3*4=12 4*4=16

1*5= 5 2*5=10 3*5=15 4*5=20 5*5=25

1*6= 6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36

1*7= 7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49

1*8= 8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64

1*9= 9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81

>>> print('大家要脚踏实地,没有一蹴而就')

大家要脚踏实地,没有一蹴而就

>>> print("不要因为其他学长的影响,改变了自己的内心")

不要因为其他学长的影响,改变了自己的内心

>>> print('听的经验很重要,但是')

听的经验很重要,但是

>>> print('大家不如先搞懂一个小程序,搞懂input,print如何使用,一步一步学')

大家不如先搞懂一个小程序,搞懂input,print如何使用,一步一步学

>>> print('心不要飘,要脚踏实地')

心不要飘,要脚踏实地

>>> print('里面放字符串a=',a)

里面放字符串a= 5

>>> print("谢谢大家,讲的不好还请体谅")

谢谢大家,讲的不好还请体谅

>>> while 1:print('i love you',end=' ')

 

兔兔RabbitMQ!!! CSDN认证博客专家 Go/GoLang Redis MySQL
全站最硬核博主(之一)。在腾讯总部工作,bat/tmd有五家发过offer。acm/leetcode刷题狂,c /Java/python/go/php各种后端语言都喜欢,安卓/node/叶子/jsp等前端也能写,最喜欢鼓捣各种组件,请多指教。
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 书香水墨 设计师:CSDN官方博客 返回首页