This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
import urllib2 as url2 | |
from bs4 import BeautifulSoup | |
import re | |
import requests | |
#from vpython import * # !!! MUST import this,otherwise you're NOT allowed to use curve or others!!! | |
from visual import * | |
from visual.graph import * | |
res = list() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert(num) : | |
num = str(num) | |
if ('e' in num): | |
index = num.index('e') | |
power = num[index+1::] | |
power = int(power) | |
num_num = num[:index] | |
output = '0.' + '0'*(abs(power)-1) + num_num | |
return (output) | |
else : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal: | |
blood = True | |
__alive = True | |
print(Animal.blood) | |
# True | |
print(Animal.alive) | |
# Error: AttributeError: type object 'Animal' has no attribute 'alive' | |
print(Animal.__alive) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal: | |
def __init__(self, food): | |
self.blood = True | |
self.__alive = True | |
self.__food = food | |
def __say_something(self): | |
print("this tutorial is so long...") | |
def set_food(self, new_food): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal: | |
def __init__(self): | |
self.__alive = True | |
self.__age = 0 | |
def get_age(self): | |
return self.__age | |
def add_age(self): | |
self.__age += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal: | |
def __init__(self): | |
self.__alive = True | |
def __print_something(self): | |
print("shxt!!!") | |
dog = Animal() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Shiba: | |
def __init__(self, height, weight): | |
self.height = height | |
self.weight = weight | |
@staticmethod | |
def pee(length): | |
print("pee" + "." * length) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Shiba: | |
pee_length = 10 | |
def __init__(self, height, weight): | |
self.height = height | |
self.weight = weight | |
@classmethod | |
def pee(cls): | |
print("pee" + "." * cls.pee_length) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Shiba: | |
pee_length = 10 | |
def __init__(self, height, weight): | |
self.height = height | |
self.weight = weight | |
@staticmethod | |
def pee(): | |
print("pee" + "." * pee_length) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import abc | |
class Dog(metaclass=abc.ABCMeta): | |
@abc.abstractmethod | |
def eat_shit(self): | |
return NotImplemented | |
class Shiba(Dog): |
OlderNewer