When the test job interview, job requirements Indication of candidates understand or are familiar with one / multi-language (java / python), to examine the basic skills of the interviewer, usually live out of a pen questions of code two questions, these questions are generally is not particularly difficult, we can quickly complete the editor in the computer, but to live a pen to write it, there is a certain degree of difficulty. This part describes some common questions and keep a pen, are provided by the code is implemented based on python 3.7.
1, find all the numbers less than 1,000 daffodils
Analysis: The so-called refers to a three-digit number daffodils, its figures on the number of Members to the third power is equal to itself. For example: 153 is a "Narcissus number", because cubic cubic cubic +3 +5 1 = 153.
1 '' ' 2 Exercise 1: Find all within daffodils 1000 Number 3 requirements: seeking all numbers less than 1000 daffodils, daffodils three-digit number 4 Analysis: on its number of bits per 3 power equals itself . 5 '' ' . 6 SXH = [] . 7 for I in Range (100, 1000 ): . 8 m = List (STR (I)) . 9 S = 0 10 for J in m: . 11 S + int = (J). 3 ** 12 is IF S == I: 13 is Print (I) 14 sxh.append (I) 15 16 Print (' Number 1000 is within daffodils ' , SXH)
2, depending on the age of the user input corresponding to the human dog come what age
Assumptions: dog before two years, equivalent to 10.5 years of people a year; next year, equivalent to every 4-year-old computing . 20 years old