day03 learning Summary

1 Pycharm use

1.1 Some basic settings

https://www.cnblogs.com/nickchen121/p/10722733.html

file --》 settings --》 editor --》general --》 change font size 。。。。

file - "settings -" editor - "font -" change the default font size

file - "settings -" editor - "color Scheme -" python - "monokai (configuration topic)

file --》 settings --》 editor --》 general --》 code completion --》case sensitive completion --》 None

Baidu pycharm personalized settings

1.2 Shortcuts

ctrl + v to paste

ctrl + c to copy

ctrl + a select all

Cut ctrl + x

ctrl + y delete the entire line

ctrl + backspace to delete a word

shift + enter wrap

ctrl + f search - "match case to match case; words matching words (space-separated words)

ctrl + d Down replication

ctrl + shift + r global search

shift + F10 to run the file on first run

ctrl + shift + f10 to run the current file

home of the line

crtl + home of the line

end end of the line

ctrl + end-file

file --》settings --》 keymap --》

pycharm shortcuts Daquan

2 variables

What are the variables: the amount will change (state - "Description of attributes about something)

2.1 define the variable

Variable name assignment symbol (=) the value of variable
name = von shaozhen
height = 165

Description (receiving variable values) assignment symbol (=) specific values

 name = 'fengshaozheng'  # 人的名字
 name1 = 'nick'
 print(name)
 print(name1)
 age = 30
 print(age)
 height = 165
 print(height)
 weight = 140

Rule 2.2 variable name

  1. Variable names have to have a sense
  2. Variable name with a letter / number / underscore (_) composition, can not start with a number
  3. Keywords can not be named
askdjflskajdf = 10
print(askdjflskajdf)

xingming = 'fengshaozhen'  # 不建议
print(xingming)

xingming = 10
 print = 1000
 print(print)  # 001010010(001010010)

关键字:['and', 'as', 'assert', 'break', 'class',
'continue', 'def', 'del', 'elif', 'else',
'except', 'exec', 'finally', 'for', 'from',
'global', 'if', 'import', 'in', 'is', 'lambda',
'not', 'or', 'pass', 'print', 'raise', 'return',
'try', 'while', 'with', 'yield']

2.3 Variable names in two ways (underscore body and hump -> more words do question the variable name)

age_of_fengshaozhen = 18  # 下划线,下划线一般用来分隔单词,这是python程序员的习惯
print(age_of_fengshaozhen)
ageOfFengshaozhen = 18  # 驼峰体(尽量不要使用,这是c的习惯)
print(ageOfFengshaozhen)

3 comments

age = 10
print(age)

ctrl + / -> Quick Notes

The concept is to provide a variable python, and you do not run, there would be "variable" appears. Running time starts python, the concept of variable appears.

3.1 Single-line comments

  1. So that the code behind the failure, the interpreter does not interpret this code is an ordinary character
  2. In front of the interpreted code

age = 18 # fengshaozhen age

More than 3.2-line comments

Three single quotes / three double quotes
`` `Python
'' '
Print (10)
Print (10)
Print (10)
Print (10)
Print (10)
Print (10)
' ''

"""
print(10)
print(10)
print(10)
print(10)
print(10)
print(10)
"""
```

Painted python

# 画波浪线--》波浪线=4多个曲线
# 画直线
# 画半圆
# 画直线

# python看成一部手机,turtle就相当于手机上的软件
import turtle

turtle.setup(650, 350, 200, 200)   # 创建画布
turtle.pensize(25)  # 控制画笔大小,默认在画布中间
turtle.penup()  # 抬笔
turtle.fd(-250)  # 前进
turtle.pendown()  # 落笔


turtle.pensize(25)
turtle.pencolor("blue")  # 修改画笔的颜色
turtle.seth(-40)  # 控制笔的方向


turtle.circle(40, 80)  # 画圆  # 40表示半径 ,80表示弧度
turtle.circle(-40, 80) # 画圆  # -40表示半径,圆心在下面,80表示弧度
turtle.circle(40, 80)  # 画圆  # 40表示半径 ,80表示弧度
turtle.circle(-40, 80) # 画圆  # -40表示半径,圆心在下面,80表示弧度
turtle.circle(40, 80)  # 画圆  # 40表示半径 ,80表示弧度
turtle.circle(-40, 80) # 画圆  # -40表示半径,圆心在下面,80表示弧度
turtle.circle(40, 80)  # 画圆  # 40表示半径 ,80表示弧度
turtle.circle(-40, 80) # 画圆  # -40表示半径,圆心在下面,80表示弧度

turtle.circle(40, 80/2)  # 矫正头部的方向
# turtle.seth(0)  # 矫正前进
turtle.fd(40)
turtle.circle(16, 180)   # 半径16,角度180
turtle.fd(40 * 2/3)


turtle.done()  # 保留画布

# 40-50
# 50-60

Results are as follows:

turtle module (library) basis

import turtle


# 画布布局

turtle.speed(4)

turtle.setup(800,600)


# 空间布局 隐式
# turtle.goto(100,100)  # 到达某一个点
# turtle.goto(-100,-100)  # 到达某一个点


# 旋转
turtle.seth(40)  # 绝对

turtle.left(30)  # 相对当前的角度而言旋转

turtle.seth(0)

turtle.right(90)


# 颜色体系
# turtle.pencolor('red')  # 画笔的颜色

# turtle.colormode(255)
# turtle.pencolor(255,0,255)  # 画笔的颜色

# turtle.colormode(1)
# turtle.pencolor(1,0,1)


turtle.pensize(10) # 控制画笔大小


# 控制画笔前进
# turtle.forward(100)
turtle.fd(100)
turtle.bk(200)
turtle.circle(20,180)



# 填充颜色
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()


# 控制画笔
turtle.penup()  # 抬笔 trutle.pu()
turtle.pendown()  # 落笔

turtle.done()


# 不固定

Guess you like

Origin www.cnblogs.com/bowendown/p/11402058.html