zoukankan      html  css  js  c++  java
  • Day2

     

    一.输出1,2,3,4,5,6,8,9,10

    #!/usr/bin/env python
    # -*- coding:utf8 -*-

    n = 1
    while n < 11 :
    if n == 7:
    pass
    else:
    print(n)
    n = n + 1
    print("end>>>>")

    二.输出1到100的和

    #!/usr/bin/env python
    #-*- coding:utf8 -*-

    n=1
    s=0
    while n < 101 :
    s = n + s
    n = n + 1
    print(s)
    print(n)
    print(s)

    三.输出1到100的奇数

    #!/usr/bin/env python
    # -*- coding:utf8 -*-

    n=1
    while n < 101:
    temp = n % 2
    if temp == 0:
    pass
    else:
    print(n)
    n = n + 1
    print("end_____fuck")

    四.输出1到100的偶数

    #!/usr/bin/env python
    # -*- coding:utf8 -*-

    n = 1
    while n < 101:
    temp = n % 2
    if temp == 0:
    print(n)
    else:
    pass
    n = n + 1
    print("end_____")

    五.输出1-2+3-4....-98+99的结果

    #!/usr/bin/env python
    # -*- coding:utf8 -*-

    n = 1
    s = 0
    while n < 100:
    temp = n % 2
    if temp == 0:
    s = s - n
    else:
    s = s + n
    n = n + 1
    print(n)
    print(s)
    print(s)

  • 相关阅读:
    Python2.7-zlib
    Python2.7-sqlite3
    Python2.7-dbm、gdbm、dbhash、bsddb、dumbdb
    Python2.7-anydbm
    Python2.7-marshal
    Python2.7-shelve
    Python2.7-copy_reg
    Python2.7-pickle, cpickle
    Python2.7-shutil
    Python2.7-fnmacth
  • 原文地址:https://www.cnblogs.com/ykblogs/p/11689001.html
Copyright © 2011-2022 走看看