1,math () function(1) ABS () #取绝对值(2) Pow (A, b) #a **b(3) round () #返回最接近的整数, if similar, returns an even numberRound (4.5) 4 round (5.5) 62. Three types of strings"" "" #描述字符串"'" #描述单个字符"" "" "" "" #处理段落字符串2). Strings can only be added to stringsstr (value) = "String3.end= "" #修改结束符, default to ' \ n 'sep= "" #指定间隔符4. Escape character\ and "Together represent a characterIf you need to reference a program, you need (\ \)such as:Import OSos.system ("\" C:\Program Files (x86) \evernote\evernote\evernote.exe\ "")5,format () Format function(1) format floating point numberformat (10.5, "10.8f") #10.8f 10 means width for alignment: 8f 8 digits after decimal point(2) format of scientific notationformat (10.55554, "10.2e")(3) percent conversion formatformat (0.222222, "10.2%")(4) format Adjustment1) Align Leftformat (5.77777, "<10.2f")2) Right alignformat (5.77777, ">10.2f")6,turtle () functionImport Turtle. ScreenSize (1024,768) #设置屏幕大小. Circle (r,steps=3) #边长为r, number of sides is 3. Begin_fill () #开始绘制. End_fill () #结束绘制. Write ("", Font= ("Arial", "normal"). setheading (#偏转60度)
Python First Order 3