Chapter 1 what is the most equitable price for supermarkets during the earthquake?
"Sold out ."
Sold out? All the flashlights in the house are sold out? Impossible. How can all of them be sold out?
What do you mean ?"
The clerk replied, "I'm sorry.
Chapter 6 after the earthquake, do supermarkets that want to raise prices or do not raise prices?
If you don't care who honors them, your achievements will be limitless-this motto has been embodied in every great leader since Moses, and since luth
# Add a dictionary# d = {##: ' Adam ',##: ' Lisa ',##: ' Bart '## }# # d[55]= ' Jack '# print (d[95])# Get key value# d = {# ' Adam ': 95,# ' Lisa ': 85,# ' Bart ': 59# }# for key in D:# Print (key+ ': ', D[key])# Determine if there is# s = set ([' Adam ', ' Lisa ', ' Bart ', ' Paul ')# x= ' Jack '# if x in S:# print (' test ')# Else:# print (' ERROR ')# Show var
; empty_list = []TaskSuppose there are 3 students in the class: Adam,lisa and Bart, their grades are 95.5,85 and 59, please follow the name, score, name, score ... The order is represented by a list of points from high to low, and then printed out.Access list by indexSince list is an ordered set, we can use a list to indicate from high to low the 3 students in the class:>>> L = [' Adam ', ' Lisa ', ' Bart '
Package Recursion;public class Hanroitower {public static void main (string[] args) {hanroitower (3, ' A ', ' B ', ' C ');} public static void Hanroitower (int n,char X,char Y,char Z) {if (n==1) {System.out.println ("Disk 1" moves from "+x+" to "+z"); Else{hanroitower (n-1,x,z,y);//the disc numbered 1 to n-1 on X is moved to Y,z as the auxiliary Tower System.out.println ("disc" +n+ "moved from" +x+ "to" +z ");// Move the disk numbered n from X to Zhanroitower (n-1, Y, X, Z);//Move the disc numbe
Article Title: ACL permission file access on Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
In Unix/Linux systems, the permission mechanism has been used for many years. Due to lack of flexibility, it is far behind and not suitable for applications in today's information systems. However, a new permission mechanism standard has been developed.This art
Is system. object the root of all types in. Net?
Written by Allen Lee
Isn't that nonsense? When you access. net, you will be reminded that all types are directly or indirectly inherited from system. object, even though msdn records similar words. Is that true? If you enter ilasm/? On the command line interface /?, You will find such a parameter:
/Noautoinherit disable inheriting from system. object by default
Now, I try to use this parameter to create a managed type without a base
Slice a list
Taking part of a list of elements is a very common operation. For example, a list is as follows:
>>> L = [' Adam ', ' Lisa ', ' Bart ', ' Paul ']
Take the first 3 elements and what you should do.
Stupid way:
>>> [l[0], l[1], l[2]]
[' Adam ', ' Lisa ', ' Bart ']
The reason is stupid way is because of expansion, take the first n elements can not.
Take the first N elements, which are indexed as
list do not necessarily require the same data type, and we can include all kinds of data in the list:>>> L = [‘Michael‘, 100, True]A list that doesn't have an element is an empty list.>>> empty_list = []8.2 Accessing the list by indexSince list is an ordered set, we can use a list to indicate from high to low the 3 students in the class:>>> L = [‘Adam‘, ‘Lisa‘, ‘Bart‘]So how do we get the names of the nth-named students from the list? The method is t
be of the same data type. We can include various types of data in the list:
L = ['Michael', 100, True]
A list that does not have an element is an empty list:
empty_list = []
# Print sequence table L = ['Adam ', 95.5, 'lisa', 85, 'bart', 59] print L
V. Accessing the list by index in Python
Because list is an ordered set, we can use a list to show three students in the course from high to low by score:
L = ['Adam
Download from linux and linux
Sed's full name is stream editor, which is a stream editor. It uses a program to edit text, which is equivalent to hacker. Sed is basically playing regular expression matching. Therefore, regular expressions are generally strong for sed users.Replace with s command
Use the following text for Demonstration:
$ cat pets.txtThis is my catmy cat's name is bettyThis is my dogmy dog's name is frankThis is my fishmy fish's name is georgeThis is my goatmy goat's name is
console:$ ssh-keygen-t Dsa-p "-F ~/.ssh/id_dsa$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keysEnter the user root directory of the Namenode, and then enter the. SSH directory to view the generated files: Authorized_keys, ID_DSA, id_dsa.pubDistribute the Authorized_keys file to a Datanode node:Verify:SSH 192.168.1.189SSH 192.168.1.116SSH slave1SSH slave2If you do not need to enter the password directly then OK, or re-match.Installing Hadoop1. Download the Hadoop 2.6.0 tar.gz file from the websi
Create list:l = [' Adam ', ' Lisa ', ' Bart ', ' gechong ', ' kongming ']Show List:l[0]Traversing List:print (L) and for loopsUpdate List:append () and insert () and direct assignmentDelete List:pop () and pop (n)List features:can add deleteLi = [' Adam ', ' Lisa ', ' Bart ', ' gechong ', ' kongming ']print (LI) for name in Li:print (name) Create Tuple:tu = (' Adam
What is DictWe already know that list and tuple can be used to represent sequential collections, for example, the name of the class:[' Adam ', ' Lisa ', ' Bart ']Or the test results list:[95, 85, 59]However, to find the corresponding score according to the name, it is inconvenient to use two list to indicate.If you associate a name with a score, make a similar look-up table:' Adam ' ==> 95' Lisa ' ==> 85' B
Python's dict and set types
1. What Python is Dict
D = { ' Adam ': +, ' Lisa ': $, ' Bart ': ', ' Paul ': 75}
2. Python's Access Dict
D = { ' adam ': 59}print, ' Lisa ': $, ' Bart ': ' Adam: ', d[' Adam ']print ' Lisa: ', d[' Lisa ']print ' Bart: ', d[' Ba RT ']
3. Features of dict in Python
D = {
This article mainly describes the Python Dict and Set types.
Python Dict and Set types
1. what is dict in Python?
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 75}2. access dict with Python
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59}print 'Adam:', d['Adam']print 'Lisa:', d['Lisa']print 'Bart:', d
We already know that list and tuple can be used to represent sequential collections, for example, the name of the class:[' Adam ', ' Lisa ', ' Bart ']Or the test results list:[95, 85, 59]However, to find the corresponding score according to the name, it is inconvenient to use two list to indicate.If you associate a name with a score, make a similar look-up table:' Adam ' ==> ' Lisa ' ==> ' Bart ' ==> 59Give
is a dictionary, actually key-value key-value pairs, similar to HashMap, you can use curly braces {} to define a struct like a C language:>>> d = { ' Adam ': 75}>>>, ' Lisa ': $, ' Bart ': ', ' Paul ': ' Lisa ': ' Paul ' on the print d{' : "Adam": Up, ' Bart ': 59}You can see that the printed results are in key:value format, and the Len function can be used to calculate its length (List,tuple can als
implemented internally.TaskUse the For loop to iterate through the algebraic column 1-100 and print a multiple of 7.Reference code:For I in Range (1,101):If i%7==0:Print IIndex iterationsIn Python, iterations are always taken out of the element itself, not the index of the element. For an ordered set, the element is indeed indexed. Sometimes we really want to get the index in the for loop, what do we do?The method is to use the enumerate () function :In enumerate (L): ... Print index, '-',
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.