# python3

# 基本输入输出

#学会使用split()的使用是关键,input()的返回值一定是字符类型

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-

 # Example Input
# 1 5
# Example Output
# a = []
for x in input().split():
a.append(int(x))
print(sum(a))

直接一行输出

 print(sum(int(x) for x in input().split()))

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-

  # Example Input
# 1 5
# 10 20
# Example Output
#
# while True:
line = input()
if line:
print(sum(int(x) for x in line.split()))
else:
break

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-

  # Example Input
#
# 1 5
# 10 20
# Example Output
#
# N = int(input())
while(N):
print(sum(int(x) for x in input().split()))
N -= 1

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-

 # Example Input
# 1 5
# 10 20
# 0 0
# Example Output
#
# while True:
a = []
for x in input().split():
a.append(int(x))
if a[0] == a[1] == 0: # 以0 0结束
break
print(sum(a))

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-

 # Example Input
# 4 1 2 3 4
# 5 1 2 3 4 5
#
# Example Output
#
# while True:
a = []
line = input()
for x in line.split():
a.append(int(x))
if a[0] == 0:
break
print(sum(a)-a[0])

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-

 # Example Input
#
# 1 2 3 4
#
# 1 2 3 4 5
#
# Example Output
#
# while(int(input())):
print(sum(int(x) for x in input().split()))

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-

 # Example Input
#
# 4 1 2 3 4
# 5 1 2 3 4 5
# Example Output
#
# N = int(input())
while N:
a = []
line = input()
for x in line.split():
a.append(int(x))
print(sum(a)-a[0])
N -= 1

这些基础部分输入输出仅供参考、欢迎交流

Python3的一些基本输入输出的更多相关文章

  1. 【python3之变量,输入输出,判断,循环】

    一.python的基础语法和规则 1.变量 ①.变量的命名规则 语法: (下划线或字母)+(任意数目的字母.数字或下划线) 变量名必须以下划线或字母开头,而后面接任意数目的字母.数字或下划线.下划线分 ...

  2. py学习日记

    From:<python编程从入门到实践> 持续更新中... 都在代码里了 第一到七章: """ Author:CruelKing Time:7/27/201 ...

  3. input()和print()函数同时输入输出多个数据--python3

    使用input()和print()函数同时输入输出多个数据,需要空格分割输入信息 #!/usr/bin/python3#-*- conding:utf-8 -*- name, age, QQ = in ...

  4. python系列十三:Python3 输入输出

    #!/usr/bin/python #Python3 输入输出 import math'''输出格式美化Python两种输出值的方式: 表达式语句和 print() 函数.第三种方式是使用文件对象的 ...

  5. Python3简单的输入输出及内置函数查看

    工作之余和女朋友一起学Python3,代码都是她敲的,有点辣眼睛,仅做参考. 1.题目:输入"姓名",输出"你好,姓名" 有关安装和打开Python shell ...

  6. python2和python3输入输出相关

    python3: #coding=utf-8 a = input("请输入你的名字:") print("%s"%a) #输出没有一点问题,a就是字符串(或者数字 ...

  7. Python3中的输入输出

    input()函数 我们可以通过Python3解释器查看Python3中input()的含义: >>> type(input) <class 'builtin_function ...

  8. python课程:python3的输入输出

    输出函数用法 (话说python3的输出好像没有python2的灵活了) print('hello,world')   #单引号和双引号都可以输出print("hello,world&quo ...

  9. Python3.7.4入门-5输入输出

    5 输入输出 5.1 格式化字符串字面值 在字符串的开始引号或三引号之前加上一个 f 或 F .在此字符串中,你可以在 { 和 } 字符之间写可以引用的变量或字面值的 Python 表达式. > ...

随机推荐

  1. 第三模块 :微服务网关Zuul架构和实践

    52.Zuul网关架构剖析~1.mp4 请求过来之后首先会通过前置过滤器,然后到路由过滤器,路由过滤器是真正访问后台远程服务的,经过路由器之后,最后会传递给后置过滤器 在三个过滤器处理的过程中任何一个 ...

  2. vwware虚拟机网卡的三种模式

    这里在虚拟机中必须要保证右上角的两个勾选上 三种模式:简单一个比如宿主机器直接连接路由器上网,那虚拟机和宿主机器是一定的可以上外网,相当于虚拟机直接连接在路由器上面,虚拟机需要配置可以上外网的IP地址 ...

  3. MapReduce 论文阅读笔记

    Abstract MapReduce : programming model 编程模型 an associated implementation for processing and generati ...

  4. .net core 静态类获取appsettings

    注入获取 通过IConfiguration直接获取的方法官方文档里就有,可以直接看这里 如:appsettings.json { "Position": { "Title ...

  5. git配置用户和邮箱

    1. 查看git用户配置 git config user.name 2. 查看git邮箱配置 git config user.email 3. 配置git用户 git config --global ...

  6. 手把手教你部署 Redis Cluster

    环境准备 阿里云申请3台ECS,如下: 序号 内网IP OS A 172.16.190.78 CentOS 7.6 B 172.16.242.36 CentOS 7.6 C 172.16.190.77 ...

  7. 什么是JSTL标签库?

    什么是JSTL? JSTL(JSP Standard Tag Library,JSP标准标签库)是一个不断完善的开放源代码的JSP标签库,是由apache的jakarta小组来维护的. 有什么作用? ...

  8. 在linux上安装jdk(转载)

    软件环境: 虚拟机:VMware Workstation 10 操作系统:Ubuntu-12.04-desktop-amd64 JAVA版本:jdk-7u55-linux-x64 软件下载地址: JD ...

  9. 以api文档为中心--前后端分开发离新思维

    api文档编写好像很简单,其实不是.一个良好的api文档,需要就有以下内容:接口详细描述,接口参数详细描述,接口返回结果详细描述,容易理解的范例.这些内容其实是不少的,编写过程中还非常单调乏味.再加上 ...

  10. Numerical Sequence (Hard vision) 题解

    The only difference between the easy and the hard versions is the maximum value of \(k\). You are gi ...