Programming/Python
Random Library and Methods
핌이 (Pimgrim)
2023. 12. 1. 19:04
import random
num = random.randrange(1, 11)
print("무작위 숫자:", num)
#colors = ["red", "orange", "yellow", "green", "blue", "purple"]
#myColor = random.choice(colors)
#print(myColor)
alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
myChar = random.choice(alphabets)
print(myChar)
OUTPUT
무작위 숫자: 10
E
반응형