Beginner python, record your journey ~
Understand the basic concept of Python, now use more is python2.7
Learned the If statement and two classic loop statements
#about the application of the IF statementName = Raw_input ('Input Name') Age= Input ('Input Age')#You can also use inputSalary = Raw_input ('Salary')#use an If statement to always have only one result, which ends when the condition is metifAge > 60: Msg='You is too old'elifAge > 30: Msg=' you aren't young'Else: Msg='You is still young'Print" "information of%s:name:%s age:%d salary:%s________________________%s" "% (name, name, age, salary, MSG)#must one by one correspond
#about for Loop (guess age)Real_age = 18 forIinchRange (10): Age= Input ('Age :') ifAge >Real_age:Print 'think smaller' elifAge <Real_age:Print 'think bigger' Else: Print ' You is right' Break Print 'You still has%s shots'% (9-i)
#about the While loop (number of selected prints)ImportSysnum=0count=0 whileCount <=1000: ifCount = =Num:Print 'There is the number', Count whileNum <=Count:num= Input ('which number does want? Inuput 0 to exist') ifnum = =0:sys.exit ()ifNum <=Count:Print 'it 's over' Else: Print 'Loop:', Count Count+ = 1Else: Print 'Loop:', Count
Python Basic Learning Day 1