Untitled

mail@pastecode.io avatar
unknown
python
7 months ago
1.3 kB
1
Indexable
Never
import random
import string

games = ["csgo", "dota", "valorant"]
games.append("minecraft")
games.remove("csgo")

# print(games[1])  # dota
# print(len(games[-1]))  # valorant

grapes = [130, 100, 140, 150, 190, 200, 250, 200, 230, 250]
grapes.sort(reverse=True)
# print(grapes)
grade1 = grapes[:3]  # Before Number
grade2 = grapes[3:6]  # Between Number
grade3 = grapes[6:]  # After Number
print("Grade 1 : ", grade1)  # 201-250
print("Grade 2 : ", grade2)  # 151-200
print("Grade 3 : ", grade3)  # 100-150


twoDList = [
    [3, 4, 5, 6, 7],  # 0
    [3, 1, 7, 8, 9],  # 1
    [1, 2, 6, 5, 7],  # 2
    [9, 0, 77, 2, 3],  # 3
]

print(twoDList[3][2])

Tupl3 = (1, 2, 3, 4, 5, 6)  # Tuple
# Tupl3[2] = 99
# print(Tupl3[2]) # cant change value in tuple
print(6 in Tupl3)  # check value in Tuple


movie = {
    "title": "Minecraft",
    "review": "10/10",
}

print(movie["review"])

movie.update({"viewers": 20000})  # add
movie["review"] = "8/10"  # change
del movie["viewers"]  # delete

print(movie)

f = ["Erwin", "kallen", "marvel"]

name = random.choice(f)

num = random.randrange(1, 100)


print("Random Password is ", name + str(num))


# HomeWork
# Make For Email (Use Random)
# Make Movie2 -> add viewers and genre, and also change the value for genre