Skip to content

Instantly share code, notes, and snippets.

@lrlucena
Created Apr 18, 2018
Embed
What would you like to do?
Listas
# Append
#a = [1, 2, 4, 8]
#a.append(16)
#print(a) #[1, 2, 4, 8, 16]
#b = []
#for i in range(10):
# x = int(input())
# b.append(x)
# print(b)
#c = list(map(int, input().split()))
#print(c)
d = list(range(1,21,2))
print(d)
# Cópia de Listas
a = [1, 2, 4, 8]
b = a[:]
b[0] = 7
a[3] = 5
print(a) # [1, 2, 4, 5]
print(b) # [7, 2, 4, 8]
print(a[:2])
print(a[0:2])
print(a[2:len(a)])
# linha por linha
b = []
for i in range(4):
x = int(input())
b.append(x)
print(b)
# todos em uma linha
c = list(map(int, input().split(",")))
print(c[0])
b.extend(c)
d = b + c
print(b)
print(d)
a,b = input().split(",")
print(a)
print(b)
x = list(input().split(","))
print(x[0])
print(x[1])
print("%3e" % 123.4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment