1. Enter a month number, returns the corresponding month name, IPO mode for this problem are:
Enter: Enter a number that represents the month (1-12)
Processing: Using the basic operation realize the function string
Output: Output corresponding month name
Code:
'''
遇到问题没人解答?小编创建了一个Python学习交流QQ群:579817333
寻找有志同道合的小伙伴,互帮互助,群里还有不错的视频学习教程和PDF电子书!
'''
month="一月份二月份三月份四月份五月份六月份七月份八月份九月份十月份十一月十二月"
for i in range(12): #插入循环,可循环12次
n=eval(input("请输入你要转换的月份(1-12):"))
pos=(n-1)*3
print("{}月份是{}".format(n,month[pos:pos+3]))
operation result:
2. Continued upward every day. Although every day, but the human development capacity is not infinite, it is consistent with a particular model. Capacity growth in line with assumptions
As model with plateau: 7-day cycle, continuous learning ability value unchanged three days, starting from day 4 to day 7 day capacity growth
1% the previous day. If you have a seven day break to learn, the period ab initio. Please write a program to answer, if the initial capacity value
1, continuous learning value of 365 days is how much?
Code:
'''
遇到问题没人解答?小编创建了一个Python学习交流QQ群:579817333
寻找有志同道合的小伙伴,互帮互助,群里还有不错的视频学习教程和PDF电子书!
'''
x=1
y=0.01
a='asistent'
b='giveup'
temp=1
state='asistent'
for i in range(365):
if state == a and (temp in [1,2,3]):
x=x
temp = (temp + 1)%7
elif state == a and (temp in [0,4,5,6]):
x=x*(1+y)
temp = (temp + 1)%7
elif state == unstudy:
temp = 0
print("365天后的能力值为:{:.2f}".format(x))
Results of the:
3. Analyzing palindrome. Let n is an arbitrary natural number, if a reverse arrangement of n digits of the resulting natural number equal to n, then n is called palindrome. From the keyboard
Enter a 5-digit number, please write a program to determine this number is not a palindrome.
Code:
while(1):
n=input("请输入一个五位数:")
if len(n)==5:
if n[::-1]==n:
print(n+"是一个回文数")
else:
print(n+"不是回文数")
else:
print("输入不符合要求")
operation result: