Skip to content

Instantly share code, notes, and snippets.

@lrlucena
Created April 18, 2018 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrlucena/0a4eb0f01af14ee0dfe86bb3a6a4597e to your computer and use it in GitHub Desktop.
Save lrlucena/0a4eb0f01af14ee0dfe86bb3a6a4597e to your computer and use it in GitHub Desktop.
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