Python Remember

 // - integral division

1. for x in range(2, 6):

  print(x) 

2. l=len(str) //find length of string

3. str[i]  // character at ith position in string

4. print(str[i],end="")  // print without enter

------------------------------------------------------------------------------------

5. use comma to catenation string and char.

6.       class Person:

          def __init__(self, name, age):

            self.name = name

            self.age = age

                p1 = Person("John", 36)

                    print(p1.name)

                    print(p1.age)





Comments

Popular Posts