Placeholder Image

字幕列表 影片播放

  • two bulls are another type of data sequences, but differently to lists they are immutable.

  • Tubules cannot be changed or modified.

  • You cannot upend or delete elements.

  • The syntax that indicates you are having a to pull and not a list is that the two poles elements are placed within parentheses and not brackets.

  • By the way, the two pool is the default sequence type in python.

  • So if I enlist three values here, the computer will perceive the new variable as a tube.

  • All we could also say the three values will be packed into a tube, all for the same reason.

  • We can assign a number of values to the same number of variables.

  • Do you remember we went through that a few lectures ago on the left side of the Equality sign.

  • We just added a to pull of variables in on the right it to pull of values.

  • That's why the relevant technical term for this activity is to pull assignment in the same way we did for lists.

  • Weaken index values by indicating their position in brackets.

  • That's why we obtained the first number from the Tupelo ex, namely 40.

  • In addition, we can also place tubules within Lis and then each to pull becomes a separate element within the list.

  • Two bulls are similar to lists, but there are some subtle differences we should not overlook.

  • They could be quite useful when dealing with different comma separated values.

  • For example, if we have a gin, years of school is variables, and I have the respect of numbers in a string format separated by a comma.

  • Hence the name comma separated values.

  • The split method, with the proper indication within the parentheses, will assign 30 as a value for age and 17 as a value four years of school.

  • We can print the two variables separately to check the outcome.

  • Everything seems to be correct.

  • Awesome.

  • Last functions can provide two poles as returned values.

  • This is useful because a function which can only return a single value otherwise can produce a to pull holding multiple values.

  • Check this code.

  • I will input on Lee the length of the side of a square, and as an output, the square info function will return A to bowl.

  • The two bull will tell me the area and the perimeter of the square.

  • This is how we can work with two pools and python.

two bulls are another type of data sequences, but differently to lists they are immutable.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B2 中高級

圖元組 (Tuples)

  • 5 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字