Python Example 1

Source: Internet
Author: User

Python Simple interactive operation, instance


Method One:

#!/usr/bin/env python

#encoding: UTF8

# Filename:interactive.py


Name= raw_input ("Please input your name:")

passwd= raw_input ("Please input your passwd:")


Count = 0

temp = 0


If name = = ' Liu ':

if passwd = = ' 123 ':

print ' Welcome login! '

Else

For I in range (4):

Count + = I

if passwd = = ' 123 ':

print ' Welcome login '

Break

if (count = = 3):

Print "You passwd locked!"

Else

passwd= raw_input ("Please reset input your passwd:")

elif passwd = = ' 123 ':

print ' true ', passwd

For x in range (4):

Temp + = X

print ' Varlue: ', temp

If name = = ' Liu ':

print ' Welcome login '

Break

if (temp = = 3):

Print "You name locked"

Break

Else

Name= Str (raw_input ("Please reset input your name:"))


Else

print ' name,passwd error!: '


#####################################################################################

Method Two:


#!/usr/bin/python

# Filename:interactive_1.py


i = 1

While 1:


Name = Raw_input ("Please input your name:")

email = raw_input ("Please input your email:")

QQ = Int (raw_input ("Please input your QQ:"))


S2 = "{NAME:[EMAIL,QQ]}"

S3 = eval (S2)

# if S3.has_key (Name):

S3 = Dict (S3.items () + s3.items ())

Print I

i + = 1

If I > 3:

Break

#s3 (S3.items ()) + = S3 (S3.items ())

# Else:

# raw_input ("First please input your information! Enter ")


Python Example 1

Related Article

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.