The second chapter of Python Learning (conditions, loops, and other statements)

1. Simple conditional Execution Statement (IF)num = Int (input ("Enter a number\n"))If num = = 0:Print ("num = 0\n")ElsePrint ("Num! = 0\n")A slightly more complex execution statement:num = Int (input ("Enter a number\n"))If num = = 0:Print ("num = 0

Python Implements scissors stone cloth (three innings and two wins)

1 #-*-coding:utf-8-*-2 ImportRandom3 4 #Best of three5 deffinger_guess ():6Rule = {1:'Rock', 2:'Paper', 3:'Scissor'}7Win_way = [['Rock','Scissor'], ['Paper','Rock'], ['Scissor','Paper']]8Num_list = [1, 2, 3]9Count =0TenPerson_score =0

Day2-python Basic 2---list, tuple operations

One, list, tuple operationsThe list is one of the most commonly used data types in the future, and the list allows for the most convenient storage, modification and other operations of the data.Definition List1 names = ["maqing"," peilin","

The first Python program

The first Python programpython3.0 print "Hello World" Python editor print: Print ("Hello world!") Establish hello.py printing: vi hello.py #!/usr/bin/env python    # Specifies the Python interpreter, env: Represents the

Definition of Python variables

Definition of Python variablesfunctions: storing data, being called, identifying data (variable data stored in memory, data is temporary)name = "ABC"#name: Variable name ABC: value of variable namePrint (name)#调用name变量, and print variablesKey

(Python) EXE launcher tool

Exhausted, wrote a small programDelay start exe with configuration file implementationAutomatically ignore lines that begin with "#" ini Template This is the path this is the delay (seconds) C:\Users\1.exe -n1 C:\Users\

Python install plug-in package considerations

Attention! Attention! Attention!It is strongly recommended to use PIP installation since Lib Library is installed:Reason:NU1: With EXE installation will appear a variety of unexpected surprises you!!!NU2: This kind of mistake is difficult to solve

Python mini-Program Shopping Cart

1Goods = [2('IPhone', 5888),3('Mac Pro', 12888),4('IWatch', 2888),5('Bike', 888),6('Cofe', 16),7(' Book', 85)8 ]9money = Int (input ("Please Input your money:"))TenBuylist = [] One whileTrue: A Print('Product List'. Center (30,'-')) -

Python Writing Login Interface

Idea One:#Coding:utf-8"""Login Interface:-Enter user name and password-show welcome message after successful authentication-lock three times after error"""ImportSys,osi=0 whileI : Name= Raw_input ('Please enter user name:') with open

Selenium2+python Automation 39-Questions about the interview

Foreword recently saw a group of small partners posted a set of interview questions, and recently job-hopping gold season, small series can not help but pull out a little time to summarize the next, the answer is not appropriate place to welcome you

Python development "modules": Requests

Requests Module1. Module descriptionRequests is an HTTP library that uses Apache2 Licensed licenses. Written in Python, really for the sake of mankind.The urllib2 module in the Python Standard library provides most of the HTTP functionality you need,

Python's print line break

Output 9*9 multiplication table.For I in range (1, ten): Print for J in range (1, i+1): print "%d*%d=%d"% (i, J, I*j);650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/8E/68/wKiom1i_oFewOu4MAAAcnspcfRw204.png-wh_500x0-wm_ 3-wmp_4-s_77511466

Python read-write JSON file description

JSON (JavaScript Object Notation) is a lightweight data interchange format. It is based on a subset of ECMAScript. JSON takes a completely language-independent text format, but also uses a similar idiom to the C language family (c, C + +, Java,

A few ways to explain the dictionary in Python

Create a dictionary >>> phonebook={' Alice ': ' 2897 ', ' Alan ': ' 0987 ', ' jery ': ' 6754 '} dict function >>> items=[(' name ', ' Gumby '), (' Age ', "]>>>") d=dict (items) >>> d{' age ': "' name ': ' Gumby '} >>> d[' name '] ' Gumby ' >>>

Pycharm developing Python Framework project generated file details

The global configuration of the project under directory Mydjangoproject is setttings.py, urls.py, and wsgi.py, respectively, 1, which setttings.py includes the system database configuration, application configuration and other configuration,2.

Check Python and Django for a way to install a successful configuration

First of all, I use Pycharm as the IDE for Development, and the Django package is automatically installed when I first create a Django project. (There are many ways to install the network separately), after the environment variable is configured

Description of classes and types in Python

What is a class? Can be considered a synonym for a kind or type. All objects belong to a class, which is called an instance of a class. For example: Birds are examples of "birds". This is a general (abstract) class with many subclasses: the bird

Python writes a simple multiplication problem

Implementation code: #! /usr/bin/python //handler #filename jiafa.py //File name Import SYS import random running = True //define running while Running: a=random.randint (0,15) //define a random number with

Description of the difference between input () and raw_input () in Python

Let's look at the source of input def input (prompt):Return eval (raw_input (Prompt)) In fact, input is also called the Raw_input, just did the eval processing And how does eval work? Input: Converts the type according to the user's inputRaw_input:

% Pylab ipython Chinese,

% Pylab ipython Chinese, Format: % pylab [-- no-import-all] [gui] This command automatically loads the numpy and matplotlib libraries in the ipython or notebook environment, which is consistent with the following statement functions: Import numpy

Total Pages: 4013 1 .... 3216 3217 3218 3219 3220 .... 4013 Go to: GO

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.