print以及类型转化
print('hello world')
print("*"*10)
price=10
print("the price:"+str(price))
name='moshi'
flag=True
rating=4.9
print(name+"\t"+str(flag)+"\t"+str(rating))
name=input("write your name:"+" \t")
print("the name:"+name)
print(int('1092'))
real=input('the age of you: ')
age=2020-int(real)
print("the age:"+str(age))
msg='''
hello ashlkdjhaslkjf
adfsglhjksadg
fsdalkjhfglsadk
'''
print(msg)
字符串以及格式化字符
msg='hello world'
print(msg[3]+"\t"+msg[-3])
print(msg[0:3])
print(msg[0:])
print(msg[:-3])
first='john'
last='smith'
msg=f'{first} [{last}]'
print(msg)
字符串方法
course="s adfadsSSSS"
print(len(course))
print(course.upper()+"\t"+course.lower())
print(course.find('fa'))
print(course.find('SSSS'))
print(course.replace('SSSS','asudhasku'))
print('a' in course)
print(course.title())
运算符以及math
1267650600228229401496703205376
print(2**100)
50.0
print(100/2)
1
print(3%2)
9.899999999999999
print(3.3*(3))
9.9
print((3.3*10000)*(3*10)/100000)
from decimal import *
a=Decimal(3)
b=Decimal(3.3)
9.899999999999999467092948180
print(a*b)
a=Decimal('3')
b=Decimal('3.3')
9.9
print(a*b)
3
print(round(3.3))
3.3
print(abs(-3.3))
import math as mh
4
print(mh.ceil(3.3))
3
print(mh.floor(3.3))