Pythonȫջѧϰ_day001֪ʶµã

2018-10-26 05:29:11À´Ô´£º²©¿ÍÔ° ÔĶÁ ()

ÐÂÀÏ¿Í»§´ó»ØÀ¡,ÔÆ·þÎñÆ÷µÍÖÁ5ÕÛ

½ñÈÕ´ó¸Ù£º
1. ±äÁ¿¡£ *****
2. ³£Á¿¡£**
3. ×¢ÊÍ¡£***
4. »ù´¡Êý¾ÝÀàÐͳõʶ£¨int£¬str£¬bool£©. *****
5. Óû§ÊäÈë input *****
6. Á÷³Ì¿ØÖÆÓï¾äif¡£ *****


1. ±äÁ¿
±àÂ뷽ʽΪutf-8£º
# -*- encoding:utf-8 -*-

print('Hello Everyone')
print(1+2+3+4+5)
print((1 + 2 + 3 + 4 + 5) * 20 / 4)
print(((1 + 2 + 3 + 4 + 5) * 20 / 4) * 5 / 2)

x = 1 + 2 + 3 + 4 + 5
print(x)
y = x * 20 / 4
z = y * 5 / 2
print(y,z)

why what how where
x y z ¾ÍÊDZäÁ¿£º±äÁ¿¾ÍÊǽ«Ò»Ð©Êý¾ÝµÄÖмä½á¹ûÔÝ´æÆðÀ´£¬ÒÔ±ãºóÐø³ÌÐòµ÷Óá£

±äÁ¿ÈçºÎʹÓ㿶¨ÒåÒ»¸ö±äÁ¿µÄ¹æ·¶
1,±äÁ¿Ö»ÄÜÓÉÊý×Ö£¬×Öĸ£¬Ï»®ÏßÈÎÒâ×éºÏ¡£
2£¬²»ÄÜÒÔÊý×Ö¿ªÍ·¡£
3£¬²»ÄÜÊÇpythonÖеĹؼü×Ö¡£
['and', 'as', 'assert', 'break', 'class', 'continue',
 'def', 'del', 'elif', 'else', 'except', 'exec', 
 'finally', 'for', 'from', 'global', 'if', 'import',
 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 
 'raise', 'return', 'try', 'while', 'with', 'yield']
4£¬±äÁ¿ÒªÓÐÃèÊöÐÔ¡£
   name = 'alex'
   age = 'taibai'
5£¬±äÁ¿²»ÄÜʹÓÃÖÐÎÄ¡£
6£¬±äÁ¿²»Äܹý³¤¡£
   fdjksaflsdsfdfjkl = 'wusir'
7, ±äÁ¿²»ÄÜʹÓÃÆ´Òô¡£
8£¬¹Ù·½ÍƼöʹÓãº
   ÍÕ·åÌå
   AgeOfOldboy = 1000

   Ï»®Ïß
   age_of_oldboy = 1000

ÔÚÄÄÀïÓ¦Óãº
¹ý³¤µÄ½á¹û£¬ÎÒÈñäÁ¿´úÌ棬ʹÓÃÆðÀ´·½±ã£¬ÇåÎú¡£
¼õÉÙÖظ´ÂÊ¡£

±äÁ¿µÄÁ·Ï°Ì⣺
1age = 2 # False
a_ = 45  # True
_ = 123  # True
_$ = 333  # False ÓÐ$ÌØÊâ×Ö·û
__ = 'alex'  # True 
123 = 666  # False
a1b = 45  # True
_ _ = 6666  # True
age1 = 12
age2 = age1
age3 = age2
age2 = 26
print(age1,age2,age3)  # 12 26 12   12 26 26  26 26 26

³£Á¿ Π£¬ÑôÀúÉúÈÕ£º12.28£¬ÐÂÖйú³ÉÁ¢ 1949

³£Á¿:Ò»Ö±²»±äµÄÁ¿¡£pythonÖб¾À´Ã»Óг£Á¿
name = 'alex'
NAME = 'wusir'
pythonÖеij£Á¿£º½«±äÁ¿È«²¿´óд¡£

ÍùÍù³£Á¿»á·ÅÔÚÎļþ×îÉÏÃæ¡£

×¢ÊÍ
ÎÄÑÔÎÄÖлáÓÐһЩÄÑÒÔÀí½âµÄ»òÕß»ÞɬÄѶ®µÄ³ÉÓï µä¹Ê£¬
¡¡¡¡ÕâÑùµÄ³ÉÓï»òÕßµä¹Ê»áÓÐһЩע½â¡£

×¢ÊÍ£º¶Ô´úÂë½âÊÍ˵Ã÷£¬°ïÖú×Ô¼º»òÕß±ðÈËÀí½â¡£

ÔõôÓã¿
µ¥ÐÐ×¢ÊÍ £º#
¶àÐÐ×¢ÊÍ£º'''±»×¢ÊÍÄÚÈÝ'''    """±»×¢ÊÍÄÚÈÝ"""

×¢ÊͲ»ÄÜÿÐж¼Óã¬ÔÚһЩÖص㣬ÄÑÒÔÀí½âµÄµØ·½Ê¹Óá£

Êý¾ÝÀàÐ͵ijõʶ¡£
ʲôÊÇÊý¾ÝÀàÐÍ?
ÈËÀà¸ø»úÆ÷»®·ÖµÄһЩÊý¾Ý£ºÊý×ÖÀàÐÍ£¬×Ö·û´®ÀàÐÍ£¬boolÖµ£¬¶ÔÓë´í¡£µÈµÈ¡£
Êý×ÖÀàÐÍ£º
¡¡¡¡float ¸¡µãÐÍ¡£  i = 3.1415
¡¡¡¡int   ÕûÐÍ¡£  i = 36  i2 = 100
¡¡¡¡ÓÃÀ´¼ÆËã»òÕß¼ÆÊý¡£

×Ö·û´®ÀàÐÍ¡£pythonÖз²ÊÇÓÃÒýºÅÒýÆðÀ´µÄ¾ÍÊÇ×Ö·û´®¡£
¡¡¡¡s1 = 'alex'
¡¡¡¡s2 = "alexÀî¸ç1"
µ¥Ë«ÒýºÅÅäºÏʹÓÃ
¡¡¡¡s3 = "I'm taibai"
¡¡¡¡print(s3)
msg = """´²Ç°Ã÷Ô¹⣬
ÒÉÊǵØÉÏ˪"""
print(msg)
×Ö·û´® µÄ +  ×Ö·û´®¿ÉÒÔÓë×Ö·û´®Ïà¼Ó ×Ö·û´®µÄÆ´½Ó

s1 = 'alex'
s2 = 'sb'
print(s1 + s2)

×Ö·û´®¿ÉÒÔÓëÊý×ÖÏà³Ë
s3 = '¼áÇ¿'
print(s3*8)

boolÖµ¡£
print(True)
print(False)
print(2 > 1)

input ³öÀ´µÄÊý¾ÝÈ«²¿¶¼ÊÇ×Ö·û´®ÀàÐÍ¡£
Óû§ÐèÒªÊäÈëÓû§ÃûÃÜÂ루qqµÇ½£©£¬´Ëʱ¾ÍÐèÒªÓû§ÊäÈëinput
print('18')
print(18)
name = input('ÇëÊäÈëÓû§Ãû£º')
age = input('ÇëÊäÈëÄêÁ䣺')
print(name)
print(type(age))  # ÅжϴËÊý¾ÝµÄÊý¾ÝÀàÐÍ
print('´ËÓû§µÄÐÕÃûÊÇ' + name +',' + '´ËÓû§µÄÄêÁäÊÇ' + age)

if Ìõ¼þÓï¾ä¡£
³õʶ½á¹¹£º

if Ìõ¼þ:
   Ö´Ðнá¹û(´úÂë¿é)

# µÚÒ»Öֽṹ£ºµ¥¶Àif
'''
print(111)
if 3 > 4 :
   print(222)
print(333)
'''

# µÚ¶þÖֽṹ£ºif else
'''
choice = int(input('ÇëÊäÈëÄã²ÂµÃ´óС£º'))
if 0<choice < 4:
   print('Äã²ÂµÃÊÇС')
else:
   print('Äã²ÂµÃÊÇ´ó')
'''

# µÚÈýÖֽṹ£º ¶à¸öÌõ¼þÑ¡1¸ö if elif elif .....
'''
choice = int(input('ÇëÊäÈëÄã²ÂÊý×Ö£º'))

if choice == 3:
   print('ÎÒÇëÄã³Ô·¹')
elif choice == 4:
   print('ÎÒÇëÄãÏ´Ôè')
elif choice == 6:
    print('ÎÒÇëÄã´ó±¦½£')
'''
# µÚËÄÖֽṹ£º if elif elif ..... else
'''
choice = int(input('ÇëÊäÈëÄã²ÂÊý×Ö£º'))

if choice == 3:
   print('ÎÒÇëÄã³Ô·¹')
elif choice == 4:
   print('ÎÒÇëÄãÏ´Ôè')
elif choice == 6:
   print('ÎÒÇëÄã´ó±¦½£')
else:
   print('Õⶼû²Â¶Ô£¬Õ汿...')

'''
# if ǶÌ×
username = input('ÇëÊäÈëÓû§Ãû£º')
password = input('ÇëÊäÈëÃÜÂ룺')

if username == 'alex':
    if password == '123':
        print('µÇ½³É¹¦')
    else:
        print('ÃÜÂëÊäÈëÓÐÎó')
else:
    print('Óû§ÃûÊäÈëÓÐÎó')

 

±êÇ©£º

°æȨÉêÃ÷£º±¾Õ¾ÎÄÕ²¿·Ö×ÔÍøÂ磬ÈçÓÐÇÖȨ£¬ÇëÁªÏµ£ºwest999com@outlook.com
Ìرð×¢Ò⣺±¾Õ¾ËùÓÐתÔØÎÄÕÂÑÔÂÛ²»´ú±í±¾Õ¾¹Ûµã£¬±¾Õ¾ËùÌṩµÄÉãÓ°ÕÕƬ£¬²å»­£¬Éè¼Æ×÷Æ·£¬ÈçÐèʹÓã¬ÇëÓëÔ­×÷ÕßÁªÏµ£¬°æȨ¹éÔ­×÷ÕßËùÓÐ

ÉÏһƪ£ºset ¼¯ºÏ

ÏÂһƪ£ºRequestsÅÀ³æ