Python first step starting from basics (i)

Source: Internet
Author: User

1. First Python program
Print " hello,world! "# After seeing it I couldn't help but put parentheses and semicolons. 

2. Variables
Name = "Wenjinli" age = #这么不正经的写法, even without distinguishing between variable types
3.for Cycle

Age = 56for I in range (3):   #想当年在OC里面是这样写的 for (nsstring*str in array) uh ....    _age = Int (input (' gessage: '))    if age = = _age:        print (' congratulation! ')        Break    Elif Age > _age:        print (' Think bigger ')    else:        print (' Think smaller! ') else:    print (' You have tried too Manylallala times ') #刷新三观的认知, actually add else after for loop

For I in range (9):
For j in Range (9):
result = (i+1) * (j+1)
Print ("{0}*{1}={2}". Format (i+1,j+1,result)) #99乘法表
4.while Cycle
Count =0 whileCount < 3: _age= Int (Input ('Gessage:'))    ifAge = =_age:Print('congratulation!')         Break    elifAge >_age:Print('think bigger')    Else:        Print('Think smaller!') Count+ = 1Else:    Print('You have tried too many times') #while竟然也可以加else

  

Python The first step starts with the basics (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.