x = 4
name = "Josh"
y = 3.2
guess = True
stuff = ["guitar", "bed"]
days = {"Monday":"favourite", "Friday": "least favourite"}
jay = (3, 9)
我正在学习Python,目前正在学习各种类型的变量。当前练习要求我选择定义哪种类型的变量。选项包括:Array,Boolean,decimal,dictionary,float,integer,list,string,tuple。有人可以查看我的答案并告诉我你是什么
答案 0 :(得分:5)
答案 1 :(得分:1)
x = 4 # this is an int (an integer)
name = "Josh" # string
y = 3.2 # float (decimal point number)
guess = True # bool (boolean)
stuff = ["guitar", "bed"] # list
days = {"Monday":"favourite", "Friday": "least favourite"} # dictionary (a hashmap, in computational-theory speak)
jay = (3, 9) # tuple (works like a list, but you can't change the elements)