标签:import second oat pytho min print pow table version
致敬hello world!
print("hello world!")
print("hello again")
print("this is the 3rd line, \n",
"and this is also the 3rd line")
print("this is the 3rd line, \
and this is also the 3rd line")
expression-> number
operator _> +-*/
print(4-5)
print(8+)
110/12.97
naming
number_of_cars = 34
x = 8 if x < 7:
print(x)
if(x < 7):
print("x is smaller than 7")
Semantics
x = 8
if x < 7:
print("x is smaller tahn 7")
print("x is bigger than 7")
variable names, and objects
variable and value
speed_of_liuxiang = 110/12.97
distance = 1000
time = distance/speed_of_liuxiang
print(time)
print(time/60)
assign new value, Mutable
speed_of_ydj= 110/10
time = distance/speed_of_ydj
print(time)
time = time -1
print(time)
data type
interger + - * / % // how big is an int? 0b10 0o10 ox10
float 98.5 type(a) import math math.pi math.e math.floor(98.6) math.ceil(98.6) math.pow(2,3) math.sqrt(25)
Boolean 1 < 2 (2< 1) or(1<2) not(2<1) type(a)
Strings s = ‘this is a string‘ type(s) print(s) ‘’‘this is the first line
this is the second line’‘’
type conversions
a = str(98.6)
a
type(a)
float(‘98.6‘)
int(‘-123‘)
1 + 2.0
True + 3
3.88 +"28"
combine & duplicate
template = "my name is "
name = "ydj"
greeting = template + ‘‘ " + name+" ."
print(greeting)
标签:import second oat pytho min print pow table version
原文地址:https://www.cnblogs.com/ydjmail/p/11611942.html