Skip to content

Latest commit

 

History

History

0x09-python-everything_is_object

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

0x09. Python - Everything is object

Resources:books:

Read or watch:


Learning Objectives:bulb:

What you should learn from this project:

  • Why Python programming is awesome
  • What is an object
  • What is the difference between a class and an object or instance
  • What is the difference between immutable object and mutable object
  • What is a reference
  • What is an assignment
  • What is an alias
  • How to know if two variables are identical
  • How to know if two variables are linked to the same object
  • How to display the variable identifier (which is the memory address in the CPython implementation)
  • What is mutable and immutable
  • What are the built-in mutable types
  • What are the built-in immutable types
  • How does Python pass variables to functions

  • What function would you use to print the type of an object?
  • How do you get the variable identifier (which is the memory address in the CPython implementation)?
  • In the following code, do a and b point to the same object? Answer with Yes or No.
  • In the following code, do a and b point to the same object? Answer with Yes or No.
  • In the following code, do a and b point to the same object? Answer with Yes or No.
  • In the following code, do a and b point to the same object? Answer with Yes or No.
  • What do these 3 lines print?
  • What do these 3 lines print?
  • What do these 3 lines print?
  • What do these 3 lines print?
  • What do these 3 lines print?
  • What do these 3 lines print?
  • What do these 3 lines print?
  • What do these 3 lines print?
  • What does this script print?
  • What does this script print?
  • What does this script print?
  • What does this script print?
  • What does this script print?
  • Write a function def copy_list(l): that returns a copy of a list.
  • a = ()
  • a = (1, 2)
  • a = (1)
  • a = (1, )
  • What does this script print?
  • What does this script print?
  • What does this script print?
  • id(a) 139926795932424

a [1, 2, 3, 4] a = a + [5] id(a)

  • a [1, 2, 3]

id (a) 139926795932424 a += [4] id(a)

  • Write a blog post about everything you just learned / this project is covering. Your blog post should be articulated this way (one paragraph per item):
  • Write a function magic_string() that returns a string “Holberton” n times the number of the iteration (see code):
  • Write a class LockedClass with no class or object attribute, that prevents the user from dynamically creating new instance attributes, except if the new instance attribute is called first_name.
  • julien@ubuntu:/python3$ cat int.py a = 1 b = 1 julien@ubuntu:/python3$
  • julien@ubuntu:/python3$ cat int.py a = 1024 b = 1024 del a del b c = 1024 julien@ubuntu:/python3$
  • julien@twix:/tmp/so$ cat int.py print("I") print("Love") print("Python") julien@ubuntu:/tmp/so$

Author