In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "Python four big data type case analysis". In daily operation, I believe many people have doubts about Python four big data type case analysis. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "Python four big data type case analysis". Next, please follow the editor to study!
The data in the basic data type numeric Python is all objects, such as the well-known int integer objects, float double-precision floating-point objects, and bool logical objects, which are all single elements. Give me two examples.
Prefix 0x to create a hexadecimal integer:
0xa5 # equals a floating-point number expressed in decimal 165s using e-creation scientific notation:
1050 # 1050.0 container objects that can hold multiple elements, such as list list object, tuple tuple object, dict dictionary object, set collection object. Python defines these types of variables and the syntax is very concise.
Examples are as follows.
Use a pair of parentheses [] to create a variable of type list:
As you can see from the schematic diagram of the lst = [1Jing 3jue 5] # list variable, the container on the right is open-loop, which means that elements can be added and deleted to the container:
Use a pair of parentheses () to create a tuple object:
As shown in the schematic diagram of the tup = (1Jing 3pm 5) # tuple variable, the container on the right is closed, which means that once the tuple is created, you can no longer add or delete elements to the container:
Note, however, that a tuple containing a single element must be followed by a comma before it can be interpreted as a tuple.
Tup = (1,) # must keep the comma or it will be considered the element itself:
In [14]: tup= (1)...: print (type (tup)) creates a dict object using a pair of curly braces {} and a colon:
The variable dictionary of dic = {'astat1,' bounded 3, 'catered 5} # is a hash table, and the following schematic diagram vividly expresses the "shape" of the dictionary.
Create a set object using only a pair of curly braces {}:
S = {1Jing 3je 5} # Container type of collection variable Python, list, dict, tuple, set, etc. can easily achieve powerful functions, here are a few examples.
1. To find the most average.
After removing one minimum value and one maximum value from the list, the average of the remaining elements is calculated.
Def score_mean (lst): lst.sort () lst2= LST [1:-1] return round ((sum (lst2) / len (lst2)), 1) lst= [9.1,9.0 8.1,9.7,19 [score_mean (lst) 9.8] score_mean (lst) # 9.1 code execution, animation demonstration:
two。 Print 99 multiplication table
Print out the multiplication table in the following format:
1 "1" 11 "2" 2 "2" 4 "41" 3 "3" 3 "3" 9 "4" 4 "4" 4 "4" 4 "4" 8 "3" 4 "4" 4 "161" 5 "5" 5 "10" 3 "15" 4 "5" 20 "5" 251 "6" 6 "6" 12 "6" 18 "4" 24 5 "6" 30 6 "6" 361 "7" 7 "7" 7 "14" 7 "21" 7 "7" 28 "535" 6 "742" 7 "7491" 8 "8" 832 "8" 24 "832" 840 "6' 848" 856 "856" 864 "9" 918 "918" 927 "4" * 9 "36 5" 9 "45 6" 54 7 "9" 63 8 "9" 72 9 "9" 81 a total of 10 lines The j column of line I is equal to: jpragi, where:
I value range: 1
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.