Python学习-1:输入输出

#!/usr/bin/env pyhton3
# -*- coding utf-8 -*-
#######################################################
#输入和输出
#######################################################
#利用print()来输出字符,输出的字符串内容需要用
#‘’或者“”括起来,也可以直接输出表达式或者函数的返回值
print("hello world")
print('100 + 200',100+ 200)


#使用input()函数来读取输入,并且把输入的数据赋值给变量
#print('you need input your name\n')
name = input('you need input your name\n')
print(name)


#在命令行中用'''...'''的格式表示多行内容
#在编写程序时可以不使用
print('''this is the first lin3
... this is the second line
... this is the third line''')
#在编写程序时可以不使用
print('''this is the first lin3
 this is the second line
 this is the third line''')
 
#格式化输出问题,基本和C语言的差不多
#%d 整数 %f浮点数 %s 字符串 %x十六进制数
print('my name is %s, i am %d years old'%('Lambor',23))
##占位符的设置也可C语言一样
s1 = 72
s2 = 85
r = (s2 / s1) - 1
print("r = %.1f" % (r))
#输出结果
r = 0.2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值