-
νμ΄μ¬ | #2 λ°μ΄ν° νμ (int, float, complex)μΉ΄ν κ³ λ¦¬ μμ 2023. 8. 3. 22:04
type() : λ°μ΄ν°μ νμ μ 보λ₯Ό μκ³ μΆμ λ μ¬μ©νλ ν¨μ
x = 16 print(type(x)) #int
νμ΄μ¬μμλ λ³μμ κ°μ λ£μ λ μλμΌλ‘ λ°μ΄ν° νμ μ΄ μ§μ λλ€.
λ¬Έμμ΄ νμ : str
name = "python" name = 'python' name = str("python")
μ«μ νμ : int, float, complex
age = 23 #int height = 160.3 #float """ complex νμ μ 볡μμ(a+bi)λ₯Ό νννλ νμ μ΄λ€. => νμ΄μ¬μμλ jλ‘ νμλ₯Ό νννλ€. complex(μ€μλΆ, νμλΆ) """ complexNumber = 1+3j complexNumber = complex(1,3)
Random Number
νμ΄μ¬μμλ λλ€μΌλ‘ μ«μλ₯Ό μΆλ ₯ν΄μ£Όλ random() ν¨μλ₯Ό μ 곡νμ§ μλλ€.
λμ λΉνΈμΈ λͺ¨λμΈ randomμ μ 곡νλ€.
#random λͺ¨λ λΆλ¬μ€κΈ° import random #1μμ 10κΉμ§μμ λλ€μΌλ‘ μΆλ ₯ print(random.randrange(1,10))
https://www.geeksforgeeks.org/complex-numbers-in-python-set-1-introduction/
https://www.w3schools.com/python/module_random.asp