GoConqr has a new look! Let us know what you think.

Notes

Untitled

Manogna Oruganti Python English 1 page

Content of the notes (1)

Page 1

Type conversion

type(varible) gives the type name

you cannot simply sum strings and floats,/int/etc in print statement. Hence convert them into string by using function str.

Similar functions such as int(), float() and bool() will help you convert Python values into any type.

lists, list of lists, subsetting lists, indexing list from back

[ : ] includeive:exclusive

Removing elements from the list is done by using function del()

Ex: del(x[1])

When you copy list to other variable, you copy the reference.

ADD

# Create list areas

areas = [11.25, 18.0, 20.0, 10.75, 9.50]

# Create areas_copy

areas_copy = list(areas)

#or areas_copy = areas[:]

# Change areas_copy

areas_copy[0] = 5.0

# Print areas

print(areas)

fam = ["mom","dad]

Functions => fun()

type(fam)

> list

Methods:: call functions on object

ex:

fam.index("dad")

> 1

In python, everything is an object and it has methods depending on type

Information

Description
Python Note on Untitled, created by Manogna Oruganti on 27/02/2019.
Created by
Manogna Oruganti · Feb 2019
Updated
Feb 27, 2019
Views
1
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?