python 學習記錄一

來源:互聯網
上載者:User

標籤:python 每天學習筆記

#!/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()                


python 學習記錄一

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.