码迷,mamicode.com
首页 > 编程语言 > 详细

python 3.5开发之旅 day1

时间:2016-07-08 15:03:23      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:

#! /usr/bin/env python
# -*- coding UTF-8 -*-
import getpass
a1 = input("inputusername:")
a2 = getpass.getpass("inputpassword:")
print(a1)
print(a2)

 

#! /usr/bin/env python
# -*- coding:utf-8 -*-

#输出1-100内的所有奇数


a = 1
while a <= 100:
    if a%2 == 1:
        print(a)
    a += 1 

       
#! /usr/bin/env python
# -*- coding:utf-8 -*-
#输出1-100内的所有偶数
a = 1 
while a <= 100:
    if a%2 == 0:
        print(a)
    a += 1 
#! /usr/bin/env python
# -*- coding:utf-8 -*-
#求 1-2+3-4...99所有数的和
a = 1
sum = 0 
while a <= 99:
  if a%2 == 1:
      sum = sum + a 
      a += 1 
  else:
      sum = sum -a
      a += 1 
print(sum)
#! /usr/bin/env python
# -*- conding:utf-8 -*-
import time
t1 = 1
while t1 < 4:
    username = input(please input your username:)
    password = input(password:)
    if username == zhangsan and password == yes:
        print(congratulations)
        break 
    elif t1 <= 2:
        print(error)
        t1 += 1
        continue
    else:
        print(forbbiden)
        time.sleep(10)
        continue

 

python 3.5开发之旅 day1

标签:

原文地址:http://www.cnblogs.com/wuyuemay/p/5648342.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!