格式化输出
#int ( ) 修改格式类型
#string 字符串
#digit 数字
#float 浮法
#name = input("waht is you name? ")
#print("Hello " + name)
name = input("Name:")
age = int ( input("Age:") )
job = input("Job:")
hometown = input("Hometown:")
#print('-----------info to '+name,'-----------')
#print('Name:' +name)
#print('Sge:' +age)
#print('Job:' +job)
#print('Hometown:' +hometown)
#print('-----------end--------------------')
info = '''
---------info to %s--------
Name: %s
Age: %d
Job: %s
Hometown: %s
---------end---------------
''' % (name,name,age,job,hometown)
print(info)
运算符
算数运算
+
-
*
/
% 取模
** 幂
// 取整除
比较运算
==
!= 不等于
<> 不等于
>
<
>=
<=
赋值运算
=
+=
-=
*=
/=
%=
**=
//=
逻辑运算
and
or
not
#int ( ) 修改格式类型
#string 字符串
#digit 数字
#float 浮法
#name = input("waht is you name? ")
#print("Hello " + name)
name = input("Name:")
age = int ( input("Age:") )
job = input("Job:")
hometown = input("Hometown:")
#print('-----------info to '+name,'-----------')
#print('Name:' +name)
#print('Sge:' +age)
#print('Job:' +job)
#print('Hometown:' +hometown)
#print('-----------end--------------------')
info = '''
---------info to %s--------
Name: %s
Age: %d
Job: %s
Hometown: %s
---------end---------------
''' % (name,name,age,job,hometown)
print(info)
运算符
算数运算
+
-
*
/
% 取模
** 幂
// 取整除
比较运算
==
!= 不等于
<> 不等于
>
<
>=
<=
赋值运算
=
+=
-=
*=
/=
%=
**=
//=
逻辑运算
and
or
not