Created
April 18, 2018 11:41
-
-
Save lrlucena/0a4eb0f01af14ee0dfe86bb3a6a4597e to your computer and use it in GitHub Desktop.
Listas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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