Bahasa Python bisa mengenal type type data apakah itu type data integer atau string secara otomatis.
Hanya contoh: x = 3 adalah intiger, sedangkan y = "text" adalah string.
Casting Data
x = 3
y = 2.153
Print("We have defined two numbers")
print("x = " + str (x))....>wrong
print("y = " + str (y))....> Wrong
Output: error
Correction of program
Print("We have defined two numbers")
print("x = ", x)
print("y = ", y)
Output:
We have defined two numbers
('x =', 3)
('y =', 2.153)
# Posting sebelumnya:
JJJJJJJJJJJJJJJJJJJ
No comments:
Post a Comment