# 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. skywalking7 源码解析 (3) :agent启动服务分析以及性能影响

    skywalking必看的文章,转载自https://blog.csdn.net/u010928589/article/details/106608864/

  2. Python3-random模块-生成伪随机数

    Python3中的random模块可以生成一个伪随机数 常用的就三个模块函数 random.random() 返回0-1之间的一个随机数 random.randrange(i, j) 返回一个随机数 ...

  3. 新版MySQL开始使用时遇到的问题(时区、权限):

    新版MySQL(本人Server version: 8.0.15)在刚开始使用时遇到的问题: 查看mysql安装版本:命令窗口 时区问题解决(The server time zone value 'Ö ...

  4. Zookeeper分布式过程协同技术 - 群首选举

    Zookeeper分布式过程协同技术 - 群首选举 群首概念 群首为集群中服务器选择出来的一个服务器,并被集群认可.设置群首目的在与对客户端所发起的状态变更请求进行排序,包括:create.setDa ...

  5. 线性dp 打鼹鼠

    鼹鼠是一种很喜欢挖洞的动物,但每过一定的时间,它还是喜欢把头探出到地面上来透透气的.根据这个特点阿Q编写了一个打鼹鼠的游戏:在一个n*n 的网格中,在某些时刻鼹鼠会在某一个网格探出头来透透气.你可以控 ...

  6. Python并发编程理论篇

    Python并发编程理论篇 前言 其实关于Python的并发编程是比较难写的一章,因为涉及到的知识很复杂并且理论偏多,所以在这里我尽量的用一些非常简明的语言来尽可能的将它描述清楚,在学习之前首先要记住 ...

  7. 抓包工具-Charles基础使用

    正在整理,等待编辑过后更新....... 竟然字少不能发不出去 那..... 现..... 在..... 够..... 了..... 吗?????? 不..... 够..... 我..... 在... ...

  8. 部署JUnit

    JUnit的简介和使用:http://blog.csdn.net/luanlouis/article/details/37562165 jar包下载地址:http://www.java2s.com/C ...

  9. Python3笔记018 - 4.3 元组

    第4章 序列的应用 python的数据类型分为:空类型.布尔类型.数字类型.字节类型.字符串类型.元组类型.列表类型.字典类型.集合类型 在python中序列是一块用于存放多个值的连续内存空间. py ...

  10. 创建虚拟机和安装centos7 & install oracle

    win7 x64位+VMware12+centos7 x64位+oracle 11g R2安装详解(一) 一.虚拟机安装oracle11g R2的安装环境: 1.win7 x64位          ...