ZHANG Yixin 15210130100

Homework1


In [2]:
import random, datetime
import numpy as np
import pylab as plt
import statsmodels.api as sm
from scipy.stats import norm
from scipy.stats.stats import pearsonr

In [3]:
str(3)


Out[3]:
'3'

In [4]:
int('5')


Out[4]:
5

In [5]:
float('7.1')


Out[5]:
7.1

In [6]:
range(10)


Out[6]:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

In [7]:
range(1,10)


Out[7]:
[1, 2, 3, 4, 5, 6, 7, 8, 9]

In [8]:
dir


Out[8]:
<function dir>

In [9]:
dir(str)[-5:]


Out[9]:
['swapcase', 'title', 'translate', 'upper', 'zfill']

In [10]:
x='Hello WorlD'
dir(x)[-10:]


Out[10]:
['rstrip',
 'split',
 'splitlines',
 'startswith',
 'strip',
 'swapcase',
 'title',
 'translate',
 'upper',
 'zfill']

In [11]:
x.lower()


Out[11]:
'hello world'

In [12]:
x.upper()


Out[12]:
'HELLO WORLD'

In [13]:
x.rstrip()


Out[13]:
'Hello WorlD'

In [14]:
x.strip()


Out[14]:
'Hello WorlD'

In [16]:
x='hello world'
type(x)


Out[16]:
str

In [ ]: