Pycharm的使用
是用来写代码的一个工具。
常用的快捷键
可以通过鼠标点击或快捷键。
- 格式化代码:Ctrl + Alt + L
- 运行代码:Ctrl + Shift + F10
- 注释代码:Ctrl + /
交互式开发与编程式开发的区别
交互式开发
- IDLE
- cmd -> python / ipython
- pycharm -> Console
编程式开发(简单理解为是否有print的区别)
Demo
下面是代码模板
a = 1
b = a
print(a == b)
a = 1
b = a
print(a == b)
public static void main(string args[]){
System.our.print("hello world")
}
public static void main(string args[]){
System.our.print(“hello world”)
}
python 基础
-缩进
python用缩进而不是{}表示程序块
-解释
用#或者‘’‘
-变量与对象
变量位于栈内存
对象位于堆内存
-***
课堂程序
对象三组成:id,type,value
#行连接符
a="abcde\
def"
a
#对象三组成:id,type,print
a=3 #a是一个变量,3是一个对象
print(a)
print(id(a))
print(type(a))
b="我爱你"
print(type(b)) #注意这里print的用法
print(id(b))
print(b)
help() #help可以请求帮助,执行以后输入keywors可以查到关键字列表
a,b=3,5
c=d=6
print(a)
del(a)
#删除不再使用的变量,如果对象没有变量引用,就会被垃圾回收器回收,清空内存空间
五环绘制
import turtle
turtle.color("blue")
turtle.circle(100)
turtle.penup()
turtle.goto(250,0)
turtle.color("black")
turtle.pendown()
turtle.circle(100)
turtle.penup()
turtle.goto(500,0)
turtle.color("red")
turtle.pendown()
turtle.circle(100)
turtle.penup()
turtle.goto(125,-100)
turtle.pendown()
turtle.color("yellow")
turtle.circle(100)
turtle.penup()
turtle.goto(375,-100)
turtle.pendown()
turtle.color("green")
turtle.circle(100)