[{"data":1,"prerenderedAt":1356},["ShallowReactive",2],{"doc-\u002Fglossary\u002Fwhat-is-a-data-type-in-python":3},{"id":4,"title":5,"body":6,"description":1349,"extension":1350,"meta":1351,"navigation":720,"path":1352,"seo":1353,"stem":1354,"__hash__":1355},"content\u002Fglossary\u002Fwhat-is-a-data-type-in-python.md","What Is a Data Type in Python?",{"type":7,"value":8,"toc":1330},"minimark",[9,13,17,20,43,46,51,54,57,90,93,96,112,177,180,196,202,206,209,266,269,380,383,392,396,399,401,415,418,439,442,465,475,482,486,489,492,521,527,595,597,666,673,677,680,683,686,748,750,783,786,793,797,800,824,826,939,941,1032,1036,1039,1042,1074,1077,1081,1084,1098,1101,1177,1179,1208,1211,1233,1237,1242,1250,1254,1257,1267,1275,1279,1291,1295,1298,1302,1326],[10,11,5],"h1",{"id":12},"what-is-a-data-type-in-python",[14,15,16],"p",{},"A data type in Python tells Python what kind of value you are working with.",[14,18,19],{},"For example, a value might be:",[21,22,23,27,30,33],"ul",{},[24,25,26],"li",{},"text",[24,28,29],{},"a whole number",[24,31,32],{},"a decimal number",[24,34,35,39,40],{},[36,37,38],"code",{},"True"," or ",[36,41,42],{},"False",[14,44,45],{},"Data types matter because they affect what you can do with a value. Python uses them to decide how values are stored and how operations should behave.",[47,48,50],"h2",{"id":49},"what-a-data-type-means","What a data type means",[14,52,53],{},"A data type describes the kind of value you are using.",[14,55,56],{},"Here are a few simple examples:",[21,58,59,67,73,79],{},[24,60,61,62,66],{},"Text uses the ",[63,64,65],"strong",{},"string"," type",[24,68,69,70,66],{},"Whole numbers use the ",[63,71,72],{},"integer",[24,74,75,76,66],{},"Decimal numbers use the ",[63,77,78],{},"float",[24,80,81,83,84,86,87,66],{},[36,82,38],{}," and ",[36,85,42],{}," use the ",[63,88,89],{},"boolean",[14,91,92],{},"Different data types support different operations.",[14,94,95],{},"For example:",[21,97,98,104,109],{},[24,99,100,101],{},"You can add numbers with ",[36,102,103],{},"+",[24,105,106,107],{},"You can join strings with ",[36,108,103],{},[24,110,111],{},"Some operations work for one type but not another",[113,114,119],"pre",{"className":115,"code":116,"language":117,"meta":118,"style":118},"language-python shiki shiki-themes material-theme-lighter github-light github-dark","print(2 + 3)\nprint(\"hello\" + \" world\")\n","python","",[36,120,121,148],{"__ignoreMap":118},[122,123,126,130,134,138,142,145],"span",{"class":124,"line":125},"line",1,[122,127,129],{"class":128},"sptTA","print",[122,131,133],{"class":132},"sP7_E","(",[122,135,137],{"class":136},"srdBf","2",[122,139,141],{"class":140},"smGrS"," +",[122,143,144],{"class":136}," 3",[122,146,147],{"class":132},")\n",[122,149,151,153,155,159,163,165,167,170,173,175],{"class":124,"line":150},2,[122,152,129],{"class":128},[122,154,133],{"class":132},[122,156,158],{"class":157},"sjJ54","\"",[122,160,162],{"class":161},"s_sjI","hello",[122,164,158],{"class":157},[122,166,141],{"class":140},[122,168,169],{"class":157}," \"",[122,171,172],{"class":161}," world",[122,174,158],{"class":157},[122,176,147],{"class":132},[14,178,179],{},"Output:",[113,181,183],{"className":115,"code":182,"language":117,"meta":118,"style":118},"5\nhello world\n",[36,184,185,190],{"__ignoreMap":118},[122,186,187],{"class":124,"line":125},[122,188,189],{"class":136},"5\n",[122,191,192],{"class":124,"line":150},[122,193,195],{"class":194},"su5hD","hello world\n",[14,197,198,199,201],{},"Even though both lines use ",[36,200,103],{},", Python handles them differently because the data types are different.",[47,203,205],{"id":204},"simple-examples-of-data-types","Simple examples of data types",[14,207,208],{},"Some common built-in Python data types are:",[21,210,211,220,229,238,248,257],{},[24,212,213,216,217],{},[63,214,215],{},"String",": text like ",[36,218,219],{},"\"hello\"",[24,221,222,225,226],{},[63,223,224],{},"Integer",": whole number like ",[36,227,228],{},"5",[24,230,231,234,235],{},[63,232,233],{},"Float",": decimal number like ",[36,236,237],{},"3.14",[24,239,240,243,244,39,246],{},[63,241,242],{},"Boolean",": ",[36,245,38],{},[36,247,42],{},[24,249,250,253,254],{},[63,251,252],{},"List",": a collection like ",[36,255,256],{},"[1, 2, 3]",[24,258,259,262,263],{},[63,260,261],{},"Dictionary",": key-value data like ",[36,264,265],{},"{\"name\": \"Sam\"}",[14,267,268],{},"Example:",[113,270,272],{"className":115,"code":271,"language":117,"meta":118,"style":118},"message = \"hello\"\ncount = 5\nprice = 3.14\nis_ready = True\nnumbers = [1, 2, 3]\nuser = {\"name\": \"Sam\"}\n",[36,273,274,289,299,310,322,349],{"__ignoreMap":118},[122,275,276,279,282,284,286],{"class":124,"line":125},[122,277,278],{"class":194},"message ",[122,280,281],{"class":140},"=",[122,283,169],{"class":157},[122,285,162],{"class":161},[122,287,288],{"class":157},"\"\n",[122,290,291,294,296],{"class":124,"line":150},[122,292,293],{"class":194},"count ",[122,295,281],{"class":140},[122,297,298],{"class":136}," 5\n",[122,300,302,305,307],{"class":124,"line":301},3,[122,303,304],{"class":194},"price ",[122,306,281],{"class":140},[122,308,309],{"class":136}," 3.14\n",[122,311,313,316,318],{"class":124,"line":312},4,[122,314,315],{"class":194},"is_ready ",[122,317,281],{"class":140},[122,319,321],{"class":320},"s39Yj"," True\n",[122,323,325,328,330,333,336,339,342,344,346],{"class":124,"line":324},5,[122,326,327],{"class":194},"numbers ",[122,329,281],{"class":140},[122,331,332],{"class":132}," [",[122,334,335],{"class":136},"1",[122,337,338],{"class":132},",",[122,340,341],{"class":136}," 2",[122,343,338],{"class":132},[122,345,144],{"class":136},[122,347,348],{"class":132},"]\n",[122,350,352,355,357,360,362,365,367,370,372,375,377],{"class":124,"line":351},6,[122,353,354],{"class":194},"user ",[122,356,281],{"class":140},[122,358,359],{"class":132}," {",[122,361,158],{"class":157},[122,363,364],{"class":161},"name",[122,366,158],{"class":157},[122,368,369],{"class":132},":",[122,371,169],{"class":157},[122,373,374],{"class":161},"Sam",[122,376,158],{"class":157},[122,378,379],{"class":132},"}\n",[14,381,382],{},"Each value has its own type.",[14,384,385,386,391],{},"If you want a broader introduction, see ",[387,388,390],"a",{"href":389},"\u002Flearn\u002Fpython-data-types-overview\u002F","Python data types overview",".",[47,393,395],{"id":394},"why-data-types-matter","Why data types matter",[14,397,398],{},"Data types matter because they affect what your code can do.",[14,400,95],{},[21,402,403,406,409,412],{},[24,404,405],{},"Numbers can be added",[24,407,408],{},"Strings behave like text",[24,410,411],{},"Some combinations of types cause errors",[24,413,414],{},"Choosing the right type makes your code easier to work with",[14,416,417],{},"This works:",[113,419,421],{"className":115,"code":420,"language":117,"meta":118,"style":118},"print(10 + 5)\n",[36,422,423],{"__ignoreMap":118},[122,424,425,427,429,432,434,437],{"class":124,"line":125},[122,426,129],{"class":128},[122,428,133],{"class":132},[122,430,431],{"class":136},"10",[122,433,141],{"class":140},[122,435,436],{"class":136}," 5",[122,438,147],{"class":132},[14,440,441],{},"But this causes a problem:",[113,443,445],{"className":115,"code":444,"language":117,"meta":118,"style":118},"print(\"10\" + 5)\n",[36,446,447],{"__ignoreMap":118},[122,448,449,451,453,455,457,459,461,463],{"class":124,"line":125},[122,450,129],{"class":128},[122,452,133],{"class":132},[122,454,158],{"class":157},[122,456,431],{"class":161},[122,458,158],{"class":157},[122,460,141],{"class":140},[122,462,436],{"class":136},[122,464,147],{"class":132},[14,466,467,468,471,472,474],{},"Python raises an error because ",[36,469,470],{},"\"10\""," is a string and ",[36,473,228],{}," is an integer. These types do not work together in that operation.",[14,476,477,478,391],{},"If you want to understand this more clearly, see ",[387,479,481],{"href":480},"\u002Ferrors\u002Ftypeerror-vs-valueerror-in-python-explained\u002F","TypeError vs ValueError in Python explained",[47,483,485],{"id":484},"how-python-knows-a-values-type","How Python knows a value's type",[14,487,488],{},"Python usually figures out the type from the value itself.",[14,490,491],{},"Common examples:",[21,493,494,499,507,514],{},[24,495,496,497],{},"Quotes usually mean a string: ",[36,498,219],{},[24,500,501,502,243,505],{},"A whole number is usually an ",[36,503,504],{},"int",[36,506,228],{},[24,508,509,510,243,512],{},"A decimal number is usually a ",[36,511,78],{},[36,513,237],{},[24,515,516,83,518,520],{},[36,517,38],{},[36,519,42],{}," are booleans",[14,522,523,524,391],{},"You can check a value's type with ",[36,525,526],{},"type()",[113,528,530],{"className":115,"code":529,"language":117,"meta":118,"style":118},"print(type(\"hello\"))\nprint(type(5))\nprint(type(3.14))\nprint(type(True))\n",[36,531,532,553,567,581],{"__ignoreMap":118},[122,533,534,536,538,542,544,546,548,550],{"class":124,"line":125},[122,535,129],{"class":128},[122,537,133],{"class":132},[122,539,541],{"class":540},"sZMiF","type",[122,543,133],{"class":132},[122,545,158],{"class":157},[122,547,162],{"class":161},[122,549,158],{"class":157},[122,551,552],{"class":132},"))\n",[122,554,555,557,559,561,563,565],{"class":124,"line":150},[122,556,129],{"class":128},[122,558,133],{"class":132},[122,560,541],{"class":540},[122,562,133],{"class":132},[122,564,228],{"class":136},[122,566,552],{"class":132},[122,568,569,571,573,575,577,579],{"class":124,"line":301},[122,570,129],{"class":128},[122,572,133],{"class":132},[122,574,541],{"class":540},[122,576,133],{"class":132},[122,578,237],{"class":136},[122,580,552],{"class":132},[122,582,583,585,587,589,591,593],{"class":124,"line":312},[122,584,129],{"class":128},[122,586,133],{"class":132},[122,588,541],{"class":540},[122,590,133],{"class":132},[122,592,38],{"class":320},[122,594,552],{"class":132},[14,596,179],{},[113,598,600],{"className":115,"code":599,"language":117,"meta":118,"style":118},"\u003Cclass 'str'>\n\u003Cclass 'int'>\n\u003Cclass 'float'>\n\u003Cclass 'bool'>\n",[36,601,602,623,637,651],{"__ignoreMap":118},[122,603,604,607,611,614,617,620],{"class":124,"line":125},[122,605,606],{"class":140},"\u003C",[122,608,610],{"class":609},"sbsja","class",[122,612,613],{"class":157}," '",[122,615,616],{"class":161},"str",[122,618,619],{"class":157},"'",[122,621,622],{"class":140},">\n",[122,624,625,627,629,631,633,635],{"class":124,"line":150},[122,626,606],{"class":140},[122,628,610],{"class":609},[122,630,613],{"class":157},[122,632,504],{"class":161},[122,634,619],{"class":157},[122,636,622],{"class":140},[122,638,639,641,643,645,647,649],{"class":124,"line":301},[122,640,606],{"class":140},[122,642,610],{"class":609},[122,644,613],{"class":157},[122,646,78],{"class":161},[122,648,619],{"class":157},[122,650,622],{"class":140},[122,652,653,655,657,659,662,664],{"class":124,"line":312},[122,654,606],{"class":140},[122,656,610],{"class":609},[122,658,613],{"class":157},[122,660,661],{"class":161},"bool",[122,663,619],{"class":157},[122,665,622],{"class":140},[14,667,668,669,391],{},"If you want to learn more about this function, see ",[387,670,672],{"href":671},"\u002Freference\u002Fpython-type-function-explained\u002F","Python type() function explained",[47,674,676],{"id":675},"variables-and-data-types","Variables and data types",[14,678,679],{},"A variable stores a value.",[14,681,682],{},"The value inside the variable has a data type.",[14,684,685],{},"In Python, you do not need to declare the type first. Python works it out when you assign the value.",[113,687,689],{"className":115,"code":688,"language":117,"meta":118,"style":118},"x = 5\nprint(type(x))\n\nx = \"hello\"\nprint(type(x))\n",[36,690,691,700,716,722,734],{"__ignoreMap":118},[122,692,693,696,698],{"class":124,"line":125},[122,694,695],{"class":194},"x ",[122,697,281],{"class":140},[122,699,298],{"class":136},[122,701,702,704,706,708,710,714],{"class":124,"line":150},[122,703,129],{"class":128},[122,705,133],{"class":132},[122,707,541],{"class":540},[122,709,133],{"class":132},[122,711,713],{"class":712},"slqww","x",[122,715,552],{"class":132},[122,717,718],{"class":124,"line":301},[122,719,721],{"emptyLinePlaceholder":720},true,"\n",[122,723,724,726,728,730,732],{"class":124,"line":312},[122,725,695],{"class":194},[122,727,281],{"class":140},[122,729,169],{"class":157},[122,731,162],{"class":161},[122,733,288],{"class":157},[122,735,736,738,740,742,744,746],{"class":124,"line":324},[122,737,129],{"class":128},[122,739,133],{"class":132},[122,741,541],{"class":540},[122,743,133],{"class":132},[122,745,713],{"class":712},[122,747,552],{"class":132},[14,749,179],{},[113,751,753],{"className":115,"code":752,"language":117,"meta":118,"style":118},"\u003Cclass 'int'>\n\u003Cclass 'str'>\n",[36,754,755,769],{"__ignoreMap":118},[122,756,757,759,761,763,765,767],{"class":124,"line":125},[122,758,606],{"class":140},[122,760,610],{"class":609},[122,762,613],{"class":157},[122,764,504],{"class":161},[122,766,619],{"class":157},[122,768,622],{"class":140},[122,770,771,773,775,777,779,781],{"class":124,"line":150},[122,772,606],{"class":140},[122,774,610],{"class":609},[122,776,613],{"class":157},[122,778,616],{"class":161},[122,780,619],{"class":157},[122,782,622],{"class":140},[14,784,785],{},"This means the same variable can later store a different type of value.",[14,787,788,789,391],{},"If you are still learning variables, see ",[387,790,792],{"href":791},"\u002Fglossary\u002Fwhat-is-a-variable-in-python\u002F","what is a variable in Python",[47,794,796],{"id":795},"common-beginner-confusion","Common beginner confusion",[14,798,799],{},"These are very common mistakes when learning data types:",[21,801,802,808,816,821],{},[24,803,804,807],{},[36,805,806],{},"\"5\""," is a string, not an integer",[24,809,810,83,812,815],{},[36,811,228],{},[36,813,814],{},"5.0"," are different types",[24,817,818,820],{},[36,819,38],{}," is a boolean, not a string",[24,822,823],{},"A list and a tuple are different types, even if they look similar",[14,825,268],{},[113,827,829],{"className":115,"code":828,"language":117,"meta":118,"style":118},"print(type(\"5\"))\nprint(type(5))\nprint(type(5.0))\nprint(type(True))\nprint(type([1, 2, 3]))\nprint(type((1, 2, 3)))\n",[36,830,831,849,863,877,891,915],{"__ignoreMap":118},[122,832,833,835,837,839,841,843,845,847],{"class":124,"line":125},[122,834,129],{"class":128},[122,836,133],{"class":132},[122,838,541],{"class":540},[122,840,133],{"class":132},[122,842,158],{"class":157},[122,844,228],{"class":161},[122,846,158],{"class":157},[122,848,552],{"class":132},[122,850,851,853,855,857,859,861],{"class":124,"line":150},[122,852,129],{"class":128},[122,854,133],{"class":132},[122,856,541],{"class":540},[122,858,133],{"class":132},[122,860,228],{"class":136},[122,862,552],{"class":132},[122,864,865,867,869,871,873,875],{"class":124,"line":301},[122,866,129],{"class":128},[122,868,133],{"class":132},[122,870,541],{"class":540},[122,872,133],{"class":132},[122,874,814],{"class":136},[122,876,552],{"class":132},[122,878,879,881,883,885,887,889],{"class":124,"line":312},[122,880,129],{"class":128},[122,882,133],{"class":132},[122,884,541],{"class":540},[122,886,133],{"class":132},[122,888,38],{"class":320},[122,890,552],{"class":132},[122,892,893,895,897,899,902,904,906,908,910,912],{"class":124,"line":324},[122,894,129],{"class":128},[122,896,133],{"class":132},[122,898,541],{"class":540},[122,900,901],{"class":132},"([",[122,903,335],{"class":136},[122,905,338],{"class":132},[122,907,341],{"class":136},[122,909,338],{"class":132},[122,911,144],{"class":136},[122,913,914],{"class":132},"]))\n",[122,916,917,919,921,923,926,928,930,932,934,936],{"class":124,"line":351},[122,918,129],{"class":128},[122,920,133],{"class":132},[122,922,541],{"class":540},[122,924,925],{"class":132},"((",[122,927,335],{"class":136},[122,929,338],{"class":132},[122,931,341],{"class":136},[122,933,338],{"class":132},[122,935,144],{"class":136},[122,937,938],{"class":132},")))\n",[14,940,179],{},[113,942,944],{"className":115,"code":943,"language":117,"meta":118,"style":118},"\u003Cclass 'str'>\n\u003Cclass 'int'>\n\u003Cclass 'float'>\n\u003Cclass 'bool'>\n\u003Cclass 'list'>\n\u003Cclass 'tuple'>\n",[36,945,946,960,974,988,1002,1017],{"__ignoreMap":118},[122,947,948,950,952,954,956,958],{"class":124,"line":125},[122,949,606],{"class":140},[122,951,610],{"class":609},[122,953,613],{"class":157},[122,955,616],{"class":161},[122,957,619],{"class":157},[122,959,622],{"class":140},[122,961,962,964,966,968,970,972],{"class":124,"line":150},[122,963,606],{"class":140},[122,965,610],{"class":609},[122,967,613],{"class":157},[122,969,504],{"class":161},[122,971,619],{"class":157},[122,973,622],{"class":140},[122,975,976,978,980,982,984,986],{"class":124,"line":301},[122,977,606],{"class":140},[122,979,610],{"class":609},[122,981,613],{"class":157},[122,983,78],{"class":161},[122,985,619],{"class":157},[122,987,622],{"class":140},[122,989,990,992,994,996,998,1000],{"class":124,"line":312},[122,991,606],{"class":140},[122,993,610],{"class":609},[122,995,613],{"class":157},[122,997,661],{"class":161},[122,999,619],{"class":157},[122,1001,622],{"class":140},[122,1003,1004,1006,1008,1010,1013,1015],{"class":124,"line":324},[122,1005,606],{"class":140},[122,1007,610],{"class":609},[122,1009,613],{"class":157},[122,1011,1012],{"class":161},"list",[122,1014,619],{"class":157},[122,1016,622],{"class":140},[122,1018,1019,1021,1023,1025,1028,1030],{"class":124,"line":351},[122,1020,606],{"class":140},[122,1022,610],{"class":609},[122,1024,613],{"class":157},[122,1026,1027],{"class":161},"tuple",[122,1029,619],{"class":157},[122,1031,622],{"class":140},[47,1033,1035],{"id":1034},"when-to-learn-more-next","When to learn more next",[14,1037,1038],{},"Once you understand the basic idea of data types, the next useful step is to learn specific types in more detail.",[14,1040,1041],{},"Good next topics are:",[21,1043,1044,1050,1056,1062,1068],{},[24,1045,1046],{},[387,1047,1049],{"href":1048},"\u002Fglossary\u002Fwhat-is-a-string-in-python\u002F","what is a string in Python",[24,1051,1052],{},[387,1053,1055],{"href":1054},"\u002Fglossary\u002Fwhat-is-an-integer-in-python\u002F","what is an integer in Python",[24,1057,1058],{},[387,1059,1061],{"href":1060},"\u002Fglossary\u002Fwhat-is-a-float-in-python\u002F","what is a float in Python",[24,1063,1064],{},[387,1065,1067],{"href":1066},"\u002Fglossary\u002Fwhat-is-a-boolean-in-python\u002F","what is a boolean in Python",[24,1069,1070],{},[387,1071,1073],{"href":1072},"\u002Flearn\u002Ftype-conversion-in-python-casting-between-types\u002F","type conversion in Python",[14,1075,1076],{},"Type conversion is especially useful because it lets you change one type into another when needed.",[47,1078,1080],{"id":1079},"common-mistakes","Common mistakes",[14,1082,1083],{},"Beginners often run into problems like these:",[21,1085,1086,1089,1092,1095],{},[24,1087,1088],{},"Treating a string like a number",[24,1090,1091],{},"Assuming all numbers are the same type",[24,1093,1094],{},"Confusing a variable name with the value's type",[24,1096,1097],{},"Mixing incompatible data types in one operation",[14,1099,1100],{},"These commands can help you check what is happening:",[113,1102,1104],{"className":115,"code":1103,"language":117,"meta":118,"style":118},"value = \"5\"\n\nprint(type(value))\nprint(isinstance(value, int))\nprint(isinstance(value, str))\n",[36,1105,1106,1119,1123,1138,1158],{"__ignoreMap":118},[122,1107,1108,1111,1113,1115,1117],{"class":124,"line":125},[122,1109,1110],{"class":194},"value ",[122,1112,281],{"class":140},[122,1114,169],{"class":157},[122,1116,228],{"class":161},[122,1118,288],{"class":157},[122,1120,1121],{"class":124,"line":150},[122,1122,721],{"emptyLinePlaceholder":720},[122,1124,1125,1127,1129,1131,1133,1136],{"class":124,"line":301},[122,1126,129],{"class":128},[122,1128,133],{"class":132},[122,1130,541],{"class":540},[122,1132,133],{"class":132},[122,1134,1135],{"class":712},"value",[122,1137,552],{"class":132},[122,1139,1140,1142,1144,1147,1149,1151,1153,1156],{"class":124,"line":312},[122,1141,129],{"class":128},[122,1143,133],{"class":132},[122,1145,1146],{"class":128},"isinstance",[122,1148,133],{"class":132},[122,1150,1135],{"class":712},[122,1152,338],{"class":132},[122,1154,1155],{"class":540}," int",[122,1157,552],{"class":132},[122,1159,1160,1162,1164,1166,1168,1170,1172,1175],{"class":124,"line":324},[122,1161,129],{"class":128},[122,1163,133],{"class":132},[122,1165,1146],{"class":128},[122,1167,133],{"class":132},[122,1169,1135],{"class":712},[122,1171,338],{"class":132},[122,1173,1174],{"class":540}," str",[122,1176,552],{"class":132},[14,1178,179],{},[113,1180,1182],{"className":115,"code":1181,"language":117,"meta":118,"style":118},"\u003Cclass 'str'>\nFalse\nTrue\n",[36,1183,1184,1198,1203],{"__ignoreMap":118},[122,1185,1186,1188,1190,1192,1194,1196],{"class":124,"line":125},[122,1187,606],{"class":140},[122,1189,610],{"class":609},[122,1191,613],{"class":157},[122,1193,616],{"class":161},[122,1195,619],{"class":157},[122,1197,622],{"class":140},[122,1199,1200],{"class":124,"line":150},[122,1201,1202],{"class":320},"False\n",[122,1204,1205],{"class":124,"line":301},[122,1206,1207],{"class":320},"True\n",[14,1209,1210],{},"Useful checks:",[21,1212,1213,1218,1223,1228],{},[24,1214,1215],{},[36,1216,1217],{},"type(value)",[24,1219,1220],{},[36,1221,1222],{},"print(type(value))",[24,1224,1225],{},[36,1226,1227],{},"isinstance(value, int)",[24,1229,1230],{},[36,1231,1232],{},"isinstance(value, str)",[47,1234,1236],{"id":1235},"faq","FAQ",[1238,1239,1241],"h3",{"id":1240},"what-is-a-data-type-in-simple-words","What is a data type in simple words?",[14,1243,1244,1245,1247,1248,391],{},"It is the kind of value you are working with, such as text, a number, or ",[36,1246,38],{},"\u002F",[36,1249,42],{},[1238,1251,1253],{"id":1252},"does-python-require-me-to-declare-data-types","Does Python require me to declare data types?",[14,1255,1256],{},"No. Python figures out the type from the value you assign.",[1238,1258,1260,1261,1263,1264,1266],{"id":1259},"is-10-the-same-as-10-in-python","Is ",[36,1262,470],{}," the same as ",[36,1265,431],{}," in Python?",[14,1268,1269,1270,471,1272,1274],{},"No. ",[36,1271,470],{},[36,1273,431],{}," is an integer.",[1238,1276,1278],{"id":1277},"how-do-i-check-a-data-type-in-python","How do I check a data type in Python?",[14,1280,1281,1282,1284,1285,39,1288,391],{},"Use the ",[36,1283,526],{}," function, such as ",[36,1286,1287],{},"type(5)",[36,1289,1290],{},"type(\"hello\")",[1238,1292,1294],{"id":1293},"why-do-data-types-matter","Why do data types matter?",[14,1296,1297],{},"They affect what operations are allowed and help prevent errors in your code.",[47,1299,1301],{"id":1300},"see-also","See also",[21,1303,1304,1308,1312,1317,1322],{},[24,1305,1306],{},[387,1307,390],{"href":389},[24,1309,1310],{},[387,1311,672],{"href":671},[24,1313,1314],{},[387,1315,1316],{"href":791},"What is a variable in Python?",[24,1318,1319],{},[387,1320,1321],{"href":1072},"Type conversion in Python",[24,1323,1324],{},[387,1325,481],{"href":480},[1327,1328,1329],"style",{},"html pre.shiki code .sptTA, html code.shiki .sptTA{--shiki-light:#6182B8;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s39Yj, html code.shiki .s39Yj{--shiki-light:#39ADB5;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .slqww, html code.shiki .slqww{--shiki-light:#6182B8;--shiki-default:#24292E;--shiki-dark:#E1E4E8}",{"title":118,"searchDepth":150,"depth":150,"links":1331},[1332,1333,1334,1335,1336,1337,1338,1339,1340,1348],{"id":49,"depth":150,"text":50},{"id":204,"depth":150,"text":205},{"id":394,"depth":150,"text":395},{"id":484,"depth":150,"text":485},{"id":675,"depth":150,"text":676},{"id":795,"depth":150,"text":796},{"id":1034,"depth":150,"text":1035},{"id":1079,"depth":150,"text":1080},{"id":1235,"depth":150,"text":1236,"children":1341},[1342,1343,1344,1346,1347],{"id":1240,"depth":301,"text":1241},{"id":1252,"depth":301,"text":1253},{"id":1259,"depth":301,"text":1345},"Is \"10\" the same as 10 in Python?",{"id":1277,"depth":301,"text":1278},{"id":1293,"depth":301,"text":1294},{"id":1300,"depth":150,"text":1301},"Master what is a data type in python in our comprehensive Python beginner guide.","md",{},"\u002Fglossary\u002Fwhat-is-a-data-type-in-python",{"title":5,"description":1349},"glossary\u002Fwhat-is-a-data-type-in-python","GD-Lz07MYxbr6RXICo3Zauv5LlpreWcF96DKL-o8e4E",1777585468113]