should be in front of y, return-1, if x should be at the back of Y, return 1. returns 0 if x and y are equal.PrintSorted ([36, 5, 12, 9, 21]) # [5, 9, 12, 21, 36]defreversed_cmp(x, y):ifX > Y:return-1ifX return1return0PrintSorted ([5, 9, reversed_cmp) # [36, 21, 12, 9, 5]PrintSorted ([' Bob ', ' about ', ' Zoo ', ' credits ']) # [' Credits ', ' Zoo ', ' about ', ' Bob ']defCmp_ignore_case(S1, s2): u1 = S1.
product:Input: [2, 4, 5, 7, 12]Output: Results of 2*4*5*7*12Method:def prod (x, y):Return X*yPrint reduce (prod, [2, 4, 5, 7, 12])Results:>>>3360Custom sort functions in Python:The python built-in sorted () function can sort the list:>>>sorted ([36, 5, 12, 9, 21])[5, 9, 12, 21, 36]But sorted () is also a high-order function, which can receive a comparison function to implement a custom sort, the definition of the comparison function is to pass in two elements to be compared x, y, if X should be
information: 1. Name: Name 2. Gender: Gender 3. Credits: SCO Re (read-only) 4. Study: Study (through the ability to continuously increase credits) ******************************************************/classstudent{ Public: //Name: Name voidSetName (string_name)//function function: Set name{m_strname=_name; } stringGetName ()//function function: Gets the name, because there is a return value, and
is mandatory to have only one phone number per record.
The above three methods, the first method is the most undesirable, according to the actual situation after the selection of two cases.
Second Normal form (2NF): If all the u,f attributes in the relational schema R (s) are completely dependent on any candidate keyword, then the relation R is called the second normal form.
Example: Elective course relationship SCI (Sno,cno,grade,credit) in which SNO for the study number, CNO for the course
the employee number is the keyword, but forces each record to have only one telephone number. The above three methods, the first method is the most undesirable, according to the actual situation after the selection of two cases.
Second Normal form (2NF): If all the u,f attributes in the relational schema R (s) are completely dependent on any candidate keyword, then the relation R is called the second normal form. Example: Elective course relationship SCI (Sno,cno,grade,credit) in which SNO for
employee number is the keyword, but it is mandatory to have only one phone number per record.
The above three methods, the first method is the most undesirable, according to the actual situation after the selection of two cases.
Second Normal form (2NF): If all the u,f attributes in the relational schema R (s) are completely dependent on any candidate keyword, then the relation R is called the second normal form.
Example: Elective course relationship SCI (Sno,cno,grade,credit) in which SNO for
information for the time being. There are several aspects to this information that we say are concerned about.Students have the basic informationWhat did the students do when they chose those classes?What are the credits for each lesson?Students belong to that department, the basic information of the Department is what.2.1 Example analysis of the second normal form (2NF)First of all, we consider that all of this information is placed in a table (stud
say are concerned about. Students have the basic information What did the students do when they chose those classes? What are the credits for each lesson? Students belong to that department, the basic information of the Department is what. 2.1 Example analysis of the second normal form (2NF) First of all, we consider that all of this information is placed in a table (student, name, age, gender, course, course credit, department, academic results, off
. Third: Is the clustered index necessarily better than the nonclustered index performance? If you want to query the credits and names of the students in the 60-90 credits, is it optimal to create a clustered index on the credits? Answer: No. Since only two columns are output, we can create a federated nonclustered index on the
Given a character, you just need to keep the valid Chinese characters or letters, numbers and the like. When you remove a special symbol or split it in some format, you can use the Re.split method. For example=============================== Restart:shell ===============================>>> s =" "Python 3.6.1 (V3.6.1:69C0DB5, Mar, 18:41:36) [MSC v.1900-bit (AMD64)] on Win32type "copyright", "Credits" O R "license ()" For more information." ">>>s'Python
programs. Whether you use bubble sorting or fast sorting, the core of the sort is to compare the size of the two elements.It is generally stipulated that for two elements x and Y, if x In this way, the sorting algorithm does not care about the specific comparison process, but is directly sorted according to the comparison results.Python built-in sorted () functionYou can sort the list:Sorted ([36, 5, 12, 9, 21])[5, 9, 12, 21, 36]The dict can be sorted:MM = Dict (A=1, b=2, c=3, d=4)Print sorted
Long ago thought to write a blog, because do a lot of things, always remember, can write down, it is a diary.This time I want to install python3.6 in my centos7 and be compatible with the original 2.7.1. View the original version of Python[[email protected] ~]# pythonPython 2.7.5 (Default, Nov 20 2015, 02:00:19)[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2Type "Help", "copyright", "credits" or "license" for more information.>>>The original version
will not want to make the same mistake the next time I go there.) )You are a teacher and need to know the credits and attendance. Every time you take a quiz or an exam, you record the students ' credits. It's easy to write the test scores in the credit book, but it's a lot of trouble to use the credit book later. As a result, you would rather not have the credits
There are three tables, Student table SC table and course table;
Student Table: School number SNO, name sname, sex ssex
Course Table: Course number CNO, course name cname, credits Ccredit
SC table: School Number SNO, course number CNO, results grade
Please use SQL statement to query student name and total course credits
(Note: If the course fails, then this course is divided into 0)
Answer:
Select St.
dependency). If present, then this part of the attribute and primary key should be separated to form a new entity, and the new entity is a one-to-many relationship with the original entity. Assume that the selection relationship table is Selectcourse (school number, name, age, course name, score, credits), keyword for the combination of keywords (study number, course name), because of the following decision relationship:
(学号, 课程名称) → (姓名, 年龄, 成绩, 学分
points AH ~ ~ is actually suddenly remembered by oneself ^_^
Enumerate ()Takes the index and value of the sequence out. Just go to the example to illustrate it ~
>>> L = [' A ', ' B ', ' C ']
>>> for IND, Val in enumerate (l):
print ("%d%s"% (ind,val))
... C18/>0 a
1 B
2 C
Sorted ()form: sorted ([Sequence],key= function, reverse=true or False)Parse: receives a sequence and sorts it. You can also sort by the specified key form. Parameter reverse is the direction of the or
theoretically, the actual situation can not be arbitrarily specified, otherwise the performance will be a nightmare. Second: Why can a clustered index be created on any column, and if the table does not have a primary key constraint, it is possible that duplicate row data exists?As a rough look, this is really the same as the constraints of the clustered index, but the actual situation is that you can create a clustered index.The reason for this analysis is that if a clustered index is not cre
student to Stu; Change the student table name to Stu
drop table if exists Stu; Delete Table Stu
Second, the operation of the table record Inserting, modifying, deleting records
Insert a new record into the table replace the old record with the replace
statement with the Insert statement . Old records that conflict with new records, such as the uniqueness of the primary key, can be deleted before the data is inserted, allowing th
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.