大家好,又见面了,我是全栈君。
#!/usr/bin/pytholn
# -*- coding: UTF-8 -*-
import math
import sys
def print_13():
#for i in range(10):
man_age = int(raw_input(‘enter input age:\n’))
if man_age >= 10 and man_age <= 12:
sex = str(raw_input(‘please input sex : M is the male or F a female and your is age :\n’))
for i in range(10):
print ‘Can you join the team!’
print ‘Thank you for your cooperation’
#break
else:
print “You are not satisfied”
print print_13()
def print_10():
n = int(raw_input(‘enter number:\n’))
if n % 3 ==0 and n % 5 == 0:
print ‘N can be divisible by 3 or 5 ‘
else:
print ‘N not be divisible by 3 or 5’
#print_10()
def print_price():
discount = 0
pice = float(raw_input(“Please enter the purchase price:\n”))
if pice >= 50 and pice <= 100:
discount = 0.1
print ‘The discount price is 10 %.’
elif pice > 100:
discount = 0.2
print ‘The discount price is 20%.’
else:
print ‘sorry ! is not discount.’
print pice * discount
#print_price()
def print_huashi():
temperature = float(raw_input(“please input temperature :\n”))
c = 5.0 / 9 * (temperature – 3)
print c
#print_huashi()
def print_sort():
l = [0,2,3,4,5]
k = []
for i in l:
k.insert(0,i)
print k
#print_sort()
def print_number():
str_num = ‘22222mmmm12232132312wqweqeqw’
result = 0
for i in str_num:
if i in ‘0123456789’:
result += 1
print result
#print_number()
def print_50():
result = ”
for i in range(1,51,1):
if i == 50:
result += str(i)
else:
result += str(i) +” “
print result
#print_50()
def list_print():
alist = [123,’abc’,4.56,[‘inner’,’list’],7-9j]
#print list_print()
def print_movices():
movices = [“The Holey Grail”,”The life of Brian”,”The Meaning of life”]
print movices[1]
#print_movices()
#比如abcd输出每一次减少一个字母输出
def print_shusu():
s = ‘abcde’
i = -1
for i in range(-1,-len(s),-1):
print s[:i]
#print_shusu()
def print_three():
l = []
for i in range(3):
x = int(raw_input(‘three number\n’))
l.append(x)
l.sort()
print l
#print_three()
print(“—————-“)
#一个整数,它加上100后是一个完全平方数,再加上268又是一个完全平方数,请问该数是多少
def print_math():
for i in range(100000):
x = int(math.sqrt(i + 100 ))
y = int(math.sqrt(i + 268 ))
if(x * x == i + 100) and (y * y == i + 268):
print i
#print_math()
print(“—————-“)
#有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?
def print_sort():
for i in range(1,5) :
for j in range(1,5) :
for k in range(1,5) :
if(i != k ) and (i != j ) and (j !=k ):
print i, j, k
#print_sort()
转载于:https://blog.51cto.com/357712148/1983378
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/107928.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...