Python Learning--Basic code practice __python

Source: Internet
Author: User

1. Python defines variables, judgment functions, loops

#-*-Coding:utf-8-*-
__author__ = ' Admin '
print (' Hello python ')
#定义变量
a =3
b = 4
c =a+b
PR Int (c)
#判断语句
score =
score >=:
   print ("excellent")
Elif score >=60:
    print ("Pass")
elif score >=
    print ("fail")
else:
    print ("very poor") #循环 for-
i in  range (1,10): Print (
    "looping practice")
    print (i)
#拼接语句
    print ("Item {0} is ok {1} hello {2}". Format (i,i*100, "Ketty"))

2. Python function

<pre style= "font-family: Song body; font-size:12pt; Background-color:rgb (255, 255, 255); ><pre name= "code" class= "python" >#-*-coding:utf-8-*-__author__
= ' Admin '
#无参函数
def SayHello ():
    print ("Hello python!")

SayHello ()
#有参函数
def Max (a,b):
    if a>b:
        return  a
    else:
        return  b
Print (max (299,899))








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.