DEPARTMENT
OF
ELECTRONICS & COMMUNICATION ENGINEERING
Presentation on
PYTHON PROGRAMMING
PRESENTED BY
Hitha C (1AH21EC020)
Dept. of ECE
UNDER THE GUIDANCE OF :
Mr. PRAVEEN A PATIL
Asst. Professor, Dept. of ECE
ACSCE, Bangalore.
ACS COLLEGE OF ENGINEERING
Lists
• Lists are used to store multiple items in a single variable.
• List items are ordered, changeable, and allow duplicate values.
• An ordered group of items
• List notation
A = [1,”This is a list”, c, Donkey(“kong”)]
• List items are indexed, the first item has index [0], the second item has index [1]
etc.
• Eg.
ACS COLLEGE OF ENGINEERING
Lists Methods
ACS COLLEGE OF ENGINEERING
List Programming Tools
• Filter(function, sequence)
• Returns a sequence consisting of the items from the sequence for which
function(item) is true
• Computes primes up to 25
ACS COLLEGE OF ENGINEERING
Map Function
• Map(function, sequence)
• Calls function(item) for each of the sequence’s items
• Computes the cube for the range of 1 to 11
ACS COLLEGE OF ENGINEERING
Reduce Function
• Reduce(function, sequence)
• Returns a single value constructed by calling the binary function (function)
• Computes the sum of the numbers 1 to 10
ACS COLLEGE OF ENGINEERING
The del statement
• A specific index or range can be deleted
ACS COLLEGE OF ENGINEERING
Dictionary
• Dictionaries are used to store data values in key:value pairs.
• A dictionary is a collection which is ordered*, changeable and do not allow
duplicates.
• Dictionaries are written with curly brackets, and have keys and values.
• Eg.
ACS COLLEGE OF ENGINEERING
Dictionaries
• Indexed by keys
• This can be any immutable type (strings, numbers…)
• Tuples can be used if they contain only immutable objects
ACS COLLEGE OF ENGINEERING
Dictionary Methods
ACS COLLEGE OF ENGINEERING
Sets
• Sets are used to store multiple items in a single variable.
• A set is a collection which is unordered, unchangeable*, and unindexed.
• Sets are written with curly brackets.
• An unordered collection with no duplicate elements
• Basket = [‘apple’, ‘orange’, ‘apple’, ‘pear’]
• Fruit
Set([‘orange’, ‘apple’, ‘pear’])
• Eg.
ACS COLLEGE OF ENGINEERING
Sets
ACS COLLEGE OF ENGINEERING
Tuple
• Tuples are used to store multiple items in a single variable.
• Tuple items are ordered, unchangeable, and allow duplicate values.
• Tuple items are indexed, the first item has index [0], the second item has index [1] etc.
• A tuple is a collection which is ordered and unchangeable.
• Tuples are written with round brackets.
• Eg.
Tuple Methods
ACS COLLEGE OF ENGINEERING
Tuples
– A number of values separated by commas
– Immutable
• Cannot assign values to individual items of a tuple
• However tuples can contain mutable objects such as lists
– Single items must be defined using a comma
• Singleton = ‘hello’,
ACS COLLEGE OF ENGINEERING
THANK YOU
ACS COLLEGE OF ENGINEERING

PYTHON PhbhujjuygrtfftgfftROGRAMMING.pptx

  • 1.
    DEPARTMENT OF ELECTRONICS & COMMUNICATIONENGINEERING Presentation on PYTHON PROGRAMMING PRESENTED BY Hitha C (1AH21EC020) Dept. of ECE UNDER THE GUIDANCE OF : Mr. PRAVEEN A PATIL Asst. Professor, Dept. of ECE ACSCE, Bangalore. ACS COLLEGE OF ENGINEERING
  • 2.
    Lists • Lists areused to store multiple items in a single variable. • List items are ordered, changeable, and allow duplicate values. • An ordered group of items • List notation A = [1,”This is a list”, c, Donkey(“kong”)] • List items are indexed, the first item has index [0], the second item has index [1] etc. • Eg. ACS COLLEGE OF ENGINEERING
  • 3.
  • 4.
    List Programming Tools •Filter(function, sequence) • Returns a sequence consisting of the items from the sequence for which function(item) is true • Computes primes up to 25 ACS COLLEGE OF ENGINEERING
  • 5.
    Map Function • Map(function,sequence) • Calls function(item) for each of the sequence’s items • Computes the cube for the range of 1 to 11 ACS COLLEGE OF ENGINEERING
  • 6.
    Reduce Function • Reduce(function,sequence) • Returns a single value constructed by calling the binary function (function) • Computes the sum of the numbers 1 to 10 ACS COLLEGE OF ENGINEERING
  • 7.
    The del statement •A specific index or range can be deleted ACS COLLEGE OF ENGINEERING
  • 8.
    Dictionary • Dictionaries areused to store data values in key:value pairs. • A dictionary is a collection which is ordered*, changeable and do not allow duplicates. • Dictionaries are written with curly brackets, and have keys and values. • Eg. ACS COLLEGE OF ENGINEERING
  • 9.
    Dictionaries • Indexed bykeys • This can be any immutable type (strings, numbers…) • Tuples can be used if they contain only immutable objects ACS COLLEGE OF ENGINEERING
  • 10.
  • 11.
    Sets • Sets areused to store multiple items in a single variable. • A set is a collection which is unordered, unchangeable*, and unindexed. • Sets are written with curly brackets. • An unordered collection with no duplicate elements • Basket = [‘apple’, ‘orange’, ‘apple’, ‘pear’] • Fruit Set([‘orange’, ‘apple’, ‘pear’]) • Eg. ACS COLLEGE OF ENGINEERING
  • 12.
  • 13.
    Tuple • Tuples areused to store multiple items in a single variable. • Tuple items are ordered, unchangeable, and allow duplicate values. • Tuple items are indexed, the first item has index [0], the second item has index [1] etc. • A tuple is a collection which is ordered and unchangeable. • Tuples are written with round brackets. • Eg. Tuple Methods ACS COLLEGE OF ENGINEERING
  • 14.
    Tuples – A numberof values separated by commas – Immutable • Cannot assign values to individual items of a tuple • However tuples can contain mutable objects such as lists – Single items must be defined using a comma • Singleton = ‘hello’, ACS COLLEGE OF ENGINEERING
  • 15.
    THANK YOU ACS COLLEGEOF ENGINEERING