美文网首页Python五期爬虫作业
【Python爬虫作业】-基础数据类型和七则运算

【Python爬虫作业】-基础数据类型和七则运算

作者: 丽雁解 | 来源:发表于2017-12-19 23:00 被阅读18次

    第一题

    a=10
    b=3
    
    c1=a/b-a
    print(a,"/",b,"-",a,"=",c1)
    print("the type of the result is:",type(c1),"\n")
    
    c2=a/b*a
    print(a,"/",b,"*",a,"=",c2)
    print("the type of the result is:",type(c2),"\n")
    
    c3=0.1*a//b-a
    print("0.1*",a,"//",b,"-",a,"=",c3)
    print("the type of the result is:",type(c3),"\n")
    
    c4=a//b+a%b
    print(a,"//",b,"+",a,"%",b,"=",c4)
    print("the type of the result is:",type(c4),"\n")
    

    第二题

    count_of_head = 35
    count_of_foot = 94
    
    number_of_rabbit = (count_of_foot - 2 * count_of_head) // 2
    number_of_chick = count_of_head - number_of_rabbit
    
    print("number_of_rabbit is ",number_of_rabbit,"\n")
    print("number_of_chick is ",number_of_chick,"\n")
    

    相关文章

      网友评论

        本文标题:【Python爬虫作业】-基础数据类型和七则运算

        本文链接:https://www.haomeiwen.com/subject/kuhwwxtx.html