3, Title: An integer, it plus 100 is a complete square number, plus 168 is a complete square number, what is the number?x+100 = N*nx+100+168 = m * mSo(m+n) * (m-n) =168#title: An integer, which plus 100 is a complete square number, plus 168 is a complete square number, what is the number? I= Range (1,100) forMinchI: forNinchi:k= (m+n) * (M-N)ifK = = 168 andM >N:#print (m,n)x = (n * n-100) y= (M * m-268) ifx = =y:Print(x)"Python
#title: If a number is exactly equal to the sum of its factors, this number is called the "end number". For example, 6=1+2+3. Programming to find all the finished numbers within 1000. defsuoyou (n): #找到所有因子 s= [] forIinchRange (1,n+1): ifn% i = =0:s.append (i) s= S[:len (s)-1] x=0#print (' All silver ', s) forIinchs:x+=IreturnxdefZhengchu (n): #因式分解 forIinchRange (2, n + 1): ifn% i = =0:k= Int (n/i) m.append (i)returnZhengchu (k)Else: Continue ifm = =[]: N= n
2, Title: The bonus awarded by the enterprise according to the profit commission. Profit (I) less than or equal to $100,000, the bonus can be raised by 10%, the profit is higher than $100,000, less than $200,000, the portion of less than 100,000 yuan by 10% commission, higher than the portion of 100,000 yuan, a commission of 7.5%, 200,000 to 400,000, higher than 200,000 yuan, can commission 5% ; Between 400,000 and 600,000 is higher than the portion of 400,000 yuan, can commission 3%, 600,000 to
contains uppercase and lowercase letters and numbers, randomly appear. User input Verification code is not case-sensitive, as long as the characters appear in the correct order to pass validation. Please write a program to complete the verification Code matching verification, assuming that the current display of the verification code is ' qs2x '. If the user enters the correct code, the output "Verification code is correct", the input error output "code error, please re-enter".
s = "Qs2
to program,,,,") the Break the elif "*" in passwd: the print ("The password cannot contain the ' * ' number!") You also have ", Count," chance ", end=") - Continue in Else: the Print ("Password entered incorrectly!") You still have ", count-1, ' Chance!" ', end= ') the count-=1" " About the ####################### Tri-color Ball the the " "print (' Red\tyellow\tblue ') + For red in range (0,4): - For yellow in range (0,4): the For Blue in range (2,7):Bayi if red + yellow + Blue ==8: the prin
illegal characters, then replace the illegal characters with the same number of * (such as Wang er), and then add to the user_list, if there is no illegal characters, then added directly to User_list, each time the addition of the successful, the new user name, the password was added.# user_list = [# {' username ': ' Barry ', ' Password ': ' 1234 '},# {' username ': ' Alex ', ' Password ': ' Asdf '},# ]# board = [' Zhang San ', ' Li Xiaoxi ', ' King two leper ']# while 1:# username=input (' use
Deepen your understanding of Python character encoding with the following exercises#\x00-\xff 256 character (S )>>>A = range (256)>>>b = Bytes (a)#No parameter encoding>>>bB ' \x00\x01\x02 ... \xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff '>>>B.decode ('Utf-8')#Error Traceback (most recent): File "", line 1, in >>>B.decode ('Unicode-escape')#Normal' \x00\x01\x02 ... \xf6÷\xf8ùú\xfbü\xfd\xfe\xff '# out of the que
1 Exercises
Describe the differences between compiled and interpreted languages, and list which languages you know are compiled and which are interpreted
Compiled language: Fast execution, Debug trouble Interpreting language: Slow execution, easy commissioning
What are the two ways to execute a Python script
Enter the interpreter's interactive mode, but cannot permanently save th
false.Finally, find and or to determine whether it is true or false.After completing these steps, you can solve the problem.Let's take a look at the above 20th questions:3! = 4 and not ("testing "! = "Test" or "Python" = "Python ")Now we install the above steps and then write the results of each step:Search for = and! = Symbol, which becomes True and not (True or True) after judgment)True and false in brac
the parameter is Ganso:In [41]: random.choice((1,3,7,4))Out[41]: 1In [42]: random.choice((1,3,7,4))Out[42]: 7
Random.shuffle: If you want to shuffle an element in a sequence (excluding Ganso and strings), you can use this function method
In [49]: list = [1,2,3,4]In [50]: random.shuffle(list)In [51]: listOut[51]: [4, 2, 1, 3]
Random.sample (A, B): A fragment of the specified length B is intercepted randomly and independently from sequence a.
In [58]: b = (9,9,9,1,2)In
Count : if count = = 8: pass Else : Print(count) = Count +12. Ask for 1-100 and.n = 1= 0 while n : = s + n Print (s) = n + 13, ask 1-100 all the oddn = 1 while n : = n%2 if temp = = 0: pass else: print(n) = n + 14. Ask for 1-100 all evenn = 1 while n : = n%2 if temp = = 0: Print (n) Else : Pass = n + 15, 1-2+3-4+5-6+7...99 all the numbers andn = 1= 0 while n := n 2 if temp = = 0: = s-
interactive interpreter? Try it and write the results.The interactive interpreter can calculate the result directlye) How can you improve the script so that it works as you think?6. Variable Assignment:1). assignment statement x, y, z = 1, 2, 3 What values will be assigned in X, Y, z respectively?2). What values do z, x, y = y, z, x, x, Y, z contain?7. The identifier. Which of the following are the valid Python identifiers? If not, please explain why
the code continues to executeTake the following example to explainTest Ajax Async Case $ ("#text"). Click (function () {//Statement 1$ ("#text"). HTML ("");//Statement 2$.ajax ({//There is no async, so the default is async:true, async URL : "ajaxcl.php",//data:{}, //Because there is no data to transfer, so do not write//type: "POST", DataType: "TEXT", success:function (data) { ///Statement 4 $ ("#text"). HTML (data);}); /Statement 3alert ($ ("#sj"). html ()); The processing page to be
Function: 26-letter exercises, including case. Background music can be switched, and background pictures may also be switched. Pick up an Apple plus 20 points, pick up a watermelon, plus 100 points.Inside the main code tutorial: (Send the code here, I hope you can make suggestions.) Can the code be streamlined ... ) The first frame of the code:
Define nub, prepare for the following ball copy ...
var num
that the fetch starts at index 0 until index 3, but does not include index 3. That is, index 0,1,2, which is exactly 3 elements. #If the first index is 0, you can also omit:Print(L[:3])#[' Michael ', ' Sarah ', ' Tracy ']#slice backwards.Print(l[-2:])#2 to 0 does not include 0 (of course, it is not possible to include 0, the index of the first element of the countdown is-1, notice that 0 is not written, otherwise it will output [])Print(L[-2:-1])#2 to-1 does not include-1, that is, the second-l
:
Use the list form and calculate the summary:#!/usr/bin/python#-*-Coding:utf-8-*-# The original answer does not indicate the number of three digits, add the number of three digits without repetitionD=[]ForAInchRange(1,5): ForBInchRange(1,5): ForCInchRange(1,5): If (A!=B) and (a!= c) andc!=b D. ([a,bc) print Len (dprint D
Hope[Email protected]Combine the For loop and if statement into one sentence and print the result directly#!
elements of the listLi = [' Alex ', ' Eric ', ' rain ', ' AA ']For I in Li: Print (i)22, write code, such as the following table, please follow the functional requirements to achieve each functionLi = ["Hello", ' Seven ', ["Mon", ["H", "Kelly"], ' all '],123,446]A. Please output "Kelly"B. Please use the index to find the ' all ' element and modify it to "all"Li = ["Hello", ' Seven ', ["Mon", ["H", "Kelly"], ' all '],123,446]A=LI[2][1][1]Print (A.capitalize ())Li = ["Hello", ' Seven ', ["Mon"
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.