Four common Bug types

1. Carelessness pwd = input('Please input a password:') if pwd == '520666' print('correct') This is the code to verify the user password. If you put it into operation, the following error will be reported. Find the error in this code and modify the code to make it run successfully: pwd = input('Please input a password:') if pwd == '5 ...

Posted by smclay on Sat, 19 Feb 2022 08:38:33 +0100

Python Lesson 7: tuples, dictionaries and collections

1. Tuple A tuple is an immutable sequenceThe symbol is () () can be omitted, but when there are other elements in the tuple, there must be = = ','==tuple1 = () empty tupleTuples can also store everything tuple1 = (1, None, False, []) Unpacking of tuples Here is an example to illustrate: # Unpacking tuple1 = (1, 2, 3) a, b, c = tuple1 print( ...

Posted by RTS on Sat, 19 Feb 2022 06:36:00 +0100

30 pieces of Python code are extremely simple, allowing you to learn a practical trick in 30 seconds

Life is short, learn Python! How to learn Python is the fastest. Of course, it is a variety of small projects in actual combat. Only when you think and write, can you remember the rules. Today I share with you 30 minimalist tasks, which beginners can try to achieve by themselves; This article is also 30 pieces of code. Python developers can al ...

Posted by Jamez on Fri, 18 Feb 2022 18:19:23 +0100

[data structure] the order table in Python -- List

College compulsory courses "Data structure and algorithm" is a required course of computer, no matter in which university. I remember that the course was implemented in C language at that time. The first data structure I came into contact with was the sequential table in the linear table, which was implemented by array. The structure ...

Posted by hothientuan on Fri, 18 Feb 2022 07:38:54 +0100

Trap of deleting elements in Java List

When a List deletes an element, the first reaction is often a for loop, which calls List based on the if condition Remove (I) or List Remove (object) to remove the elements on the collection. public static void main(String[] args) { List<String> list = new ArrayList(2) { { add("a"); add("b"); } ...

Posted by dunn_cann on Tue, 15 Feb 2022 11:55:21 +0100

Python learning list, for loop, slice, tuple

Python learning (2) list The list consists of a series of elements arranged in a specific order. The list can store almost all elements such as letters, numbers and strings. There is no relationship between the elements. The list is somewhat similar to a one-dimensional array. In Python, lists are represented by square brackets [] and el ...

Posted by Michael on Fri, 11 Feb 2022 21:32:54 +0100

Day 20 of learning big data - Collection, list

The 20th day of learning big data - Collection and List (because you need to accompany your family for the new year, there is no time for learning to continue recording, and it will continue to be updated every day from today) Learning step by step according to the appeal map can get twice the result with half the effort aggregate The differ ...

Posted by danaman on Fri, 11 Feb 2022 05:20:04 +0100

Redis operation Python series, redis basic command list | CSDN creation punch in

Reading guide The list type is a simple list of strings, sorted in insertion order. Each list can store up to 232 - 1 elements (more than 4 billion). The list types mainly include the following application scenarios. Personal use is more non paged data lists, or lists with less changes. 1. Message queue List type lpop and rpush (or co ...

Posted by SsirhC on Mon, 07 Feb 2022 00:22:52 +0100

Python basic 100 questions punch in Day11

Title 38 For a given tuple (1, 2, 3, 4, 5, 6, 7, 8, 9, 10), write a program to print the first half value in one line and the last half value in one line. code implementation Method 1: use the loop to output the tuple data tpl = (1,2,3,4,5,6,7,8,9,10) for i in range(0,5): print(tpl[i],end= ' ') print() for i in range(5,10): print(t ...

Posted by michalchojno on Thu, 03 Feb 2022 00:16:21 +0100

Learn the List set in the Java set from the source code, detailed and thorough, in one step

summary A List is an ordered set (also known as a sequence). Users of this interface have precise control over where each element in the List is inserted. Users can access elements through their integer index (position in the List) and search for elements in the List. In fact, it is just a idiom to say that it is a sub interface of the Col ...

Posted by paulsiew2 on Wed, 02 Feb 2022 11:34:13 +0100