zoukankan      html  css  js  c++  java
  • python day02 作业答案

    1. 

    (1).false   (2).false

    2. 

    (1).8  (2).4

    3. 

    (1).6  (2).3  (3).false (4).3   (5).true   (6).true  (7).0  (8).3  (9).0 (10).2

    4.

    (1).while True:

      循环体

        else:

      跳出循环执行这里

    5.

    count=1
    while 1:
        number=input("猜猜我的数字:")
        if int(number)==66:
            print("回答正确")
            break
        elif int(number)< 66:
            print("猜小了")
        else :
            print("猜大了")

    6.

    count=1
    while 1:
        number=input("猜猜我的数字:")
        if int(number)==66:
            print("回答正确")
            break
        elif count ==2:
            print("太笨了")
            count=count+1

    7.

    count=1
    while count<=10:
        print(count)
        count+=1

    8.

    count=1
    sum=1
    while count<=99:
        count += 1
        sum=sum+count
    print(sum)

    9.

    count=1
    while count<=100:
        if count %2!=0:
            print(count)
        count += 1

    10.

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

    11.

    sum=1
    count=1
    while count<99:
        count=count+1
        if count %2 ==0:
            sum=sum-count
        else :
            sum=sum+count

    12.

    count=1
    while count<=3:
        username = input('请输入用户名:')
        password = input("请输入密码:")
        if username=='apple' and password =='123456':
            print('登陆成功')
            break
        else :
            print("登陆失败")
            print("还剩"+str(3-count)+"")
        count=count+1

    13.

    14.

    a=''
    b='第一'
    c='稀缺'
    d='国家级'
    ad=input("输入广告:")
    if (a  or b  or c or d) in ad:
        print("不合法")
    else:
        print('合法')
  • 相关阅读:
    开始之旅9.18
    驱动学习
    Extjs TextField扩展
    数据结构经典算法java
    JAVA BeanUtil应用 一个类向另一个类转换
    Extjs timefield
    图片压缩成指定大小
    js正则表达式提取字符串中的数字
    STM32笔记记录2
    #ifdef,#else,#endif,#if用法详解
  • 原文地址:https://www.cnblogs.com/snackpython/p/9898973.html
Copyright © 2011-2022 走看看