PYTHON AND HADOOP BASICS: PROGRAMMING FOR BEGINNERS - 2 BOOKS IN 1 - Learn Coding Fast! PYTHON AND HADOOP Crash Course, A QuickStart Guide, Tutorial Book by Program Examples, In Easy Steps! by SEL TAM & KING J
Author:SEL, TAM & KING, J [SEL, TAM]
Language: eng
Format: epub
Published: 2020-07-08T16:00:00+00:00
Output:
HelloHelloHello
Hello world
o
ll
False
False
C://python37
The string str : Hello
Python Tuple
Python Tuple is used to store unchanged Python object set. The tuple is similar to lists since it is possible to adjust the value of the items stored in the array, whereas the tuple is immutable and it is not possible to alter the value of the items stored in the tuple.
A tuple can be written as a collection of comma-separated(,) values accompanied by the small() brackets. The parentheses are optional but use of them is good practice. They may describe a tuple as follows.
T1 = ( 101 , "Peter" , 22 )
T2 = ( "Apple" , "Banana" , "Orange" )
T3 = 10 , 20 , 30 , 40 , 50
print(type(T1))
print(type(T2))
print(type(T3))
Output:
<class 'tuple'>
<class 'tuple'>
<class 'tuple'>
A tuple is indexed as is the case for the lists. You can view the items in tuple using their unique index value.
Example - 1
tuple1 = ( 1 0 , 2 0 , 3 0 , 4 0 , 5 0 , 6 0 )
print(tuple1)
count = 0
fo r i in tuple1:
print ( "tuple1[%d] = %d " %(count, i))
count = count + 1
Output:
(10, 20, 30, 40, 50, 60)
tuple1[0] = 10
tuple1[1] = 20
tuple1[2] = 30
tuple1[3] = 40
tuple1[4] = 50
tuple1[5] = 60
Example - 2
tuple1 = tuple(input( "Enter the tuple elements ... " ))
print(tuple1)
count = 0
fo r i in tuple1:
print( "tuple1[%d] = %s " %(count, i))
count = count+ 1
Output :
Enter the tuple elements ...123456
('1', '2', '3', '4', '5', '6')
tuple1[0] = 1
tuple1[1] = 2
tuple1[2] = 3
tuple1[3] = 4
tuple1[4] = 5
tuple1[5] = 6
Basic Tuple operations
Operator
Description
Example
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Access | Data Mining |
Data Modeling & Design | Data Processing |
Data Warehousing | MySQL |
Oracle | Other Databases |
Relational Databases | SQL |
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8274)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(6589)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(6564)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(6437)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(6215)
Driving Data Quality with Data Contracts by Andrew Jones(6180)
Learning SQL by Alan Beaulieu(5980)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(5937)
Weapons of Math Destruction by Cathy O'Neil(5765)
Big Data Analysis with Python by Ivan Marin(5279)
Data Engineering with dbt by Roberto Zagni(4292)
Solidity Programming Essentials by Ritesh Modi(3933)
Time Series Analysis with Python Cookbook by Tarek A. Atwan(3787)
Pandas Cookbook by Theodore Petrou(3502)
Blockchain Basics by Daniel Drescher(3285)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2896)
Feature Store for Machine Learning by Jayanth Kumar M J(2807)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2789)
Mastering Python for Finance by Unknown(2740)
