Python Exercise 1

Source: Internet
Author: User

# Encoding:utf-8

#公鸡5文钱一只, hen 3 cents A, chicken 3 only a penny, with 100 cents to buy 100 chickens,
#其中公鸡, hens, chickens have to have, ask the rooster, hen, how many chickens to buy just just to fill 100 cents.

# 5 3 1/3

# 20>x>0 32>y>0 z>0

# x+y+z=100

# 5x + 3y +1/3z=100

For x in range (20):
For Y in range (32):
Z =100-(x+y)
if (5*x+3*y+z/3==100) and (z%3==0) and (x>0) and (y>0):
Print ("Rooster is%d, hen is%d, chick is%d"% (x, y, z))
Y+=1
X+=1

Python Exercise 1

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.