Python learning path 01, python path 01
Preface
As a programmer, I had no experience with other computer-related knowledge after I took the Level 2 Test of VB in my junior year. After being admitted to the Graduate School of materials, I feel that I do not want to continue in this industry. I chose computer as my path. The determination I made was only three or five days later. The fastest growing part of China is Internet and finance, and the traditional materials I have learned seem a little out of sync with the times (because of my low level, I can only see this layer ). I also checked some information when I decided to learn Jave and Python. For me, Python has a better external library resource and simpler syntax than Jave, and it is more readable. In short, each language has its own characteristics, no bad language, only bad programmers. The reason why I wrote a blog is to share my feelings about learning Python, which is also a review. If something is wrong, I must change it ~
A review of this week's study
1. About strings. Only letters, numbers, and underscores are allowed. numbers cannot be headers. uppercase conventions are used to indicate constants. # Is Used for single-line comments, and ''' are used to box the content. It can also be used for multi-line printing. There is no difference between 'and' in Python.
2. hello world: the first one to be learned in every programming process ~
print("hello python world")
2. var: da pao eli after running the program
name="eli"name2=name
print("my name is",name)
name="da pao"
print(name,name2)
3. input: I understand the output as follows (is this interaction ?)
name=input("mame:")age=int(input("age:"))job=input("job:")salary=input("salary:")info='''---info of %s---name:%sage:%sjob:%ssalary:%s'''% (name,name,age,job,salary)#print(info)info2='''---info of {_name}---name:{_name}age:{_age}job:{_job}salary:{_salary}'''.format(_name=name, _age=age, _job=job, _salary=salary)#print(info2)info3='''---info of {0}---name:{0}age:{1}job:{2}salary:{3}'''.format(name,age,job,salary)print(info3)
The results are the same in three ways.
4. Use the while statement
age_of_oldboy = 56count = 0while count<3: guess_age = int(input("guess age:")) if guess_age == age_of_oldboy: print("yes,you got it") break elif guess_age < age_of_oldboy: print("think smaller...") else: print("think bigger") count +=1else: print("you have tried too many times...fuck off")
5. Use the for statement
'''for i in range(0,10): if i>3: print('loop',i) else: continue print('hehehe...')'''for i in range(10): print("----",i) for j in range(10): print(j) if j>5: break
This is what we learned for the first time, and will be updated from time to time ~