Python学习之路
第一例:
# -*- coding:utf-8 -*-
from pip._vendor.distlib.compat import raw_input
user = raw_input("plaese input user name:")
pwd = raw_input("plaese input password:")
if user == "allen" and pwd == "allen":
print ("登录成功!")
else:
print ("登录失败!")
第二例:
100块钱,公鸡5块一只,母鸡3块一只,3只小鸡一块钱
x+y+z=100;
5x+3y+z/3=100;
# -*- coding:utf-8 -*-
for x in range(1,20):
for y in range(1,33):
z = 100-x-y
if (z % 3 == 0) and (x * 5 + y * 3 + z / 3 == 100):
s = "公鸡:%d只: 母鸡: %d只: 小鸡: %d只" % (x,y,z)
print(s)
原文:https://www.cnblogs.com/allenzhang2020/p/12246750.html