PYTHON PRACTICE

  1. Print out “This is python class”
  2. Print out the remainder of 97 divided by 24
  3. Print out the result of 4 power 6
  4. The price of apple is 8, you have cash 100, you want to buy two apples, calculate the money you have(calculate it with variables total, apple, remain)
  5. make an introduction
    example:
    name = …
    age = …
    gender = …
    hobby = …
    print out the result using variable. The string will look like this:
    my name is xxx, I am xx years old, I am a xxx(gender), I like xxx(hobby)
  6. make an introduction with input().
  7. create a list with your favorite singers,
    then append it, insert it, pop it, take out the value where the index is 1
  8. create a dictionary where key is everybody’s name in this class, value is gender.
    Then take out the value where the key is your name
  9. create two sets s1 = {1, 2, 3, 6, 7, 9}, s2 = {3, 4, 7, 8, 10}, print out s1 & s2, s1 | s2
  10. Bob's height is 1.75m, his weight is 80.5kg, calculate Bob's BMI(weight / (height * height), using 'if elif' print out the result
    ? below 18.5:too light
    ? 18.5-25:normal
    ? 25-28:fat
    ? 28-32:too fat
    ? 32:super fat
  11. using for loop to print out 'Hello, xxx!':L = ['Bart', 'Lisa', 'Adam']
  12. define a function called quadratic(a, b, c), return answers of ax2 + bx + c = 0 (hint: use math.sqrt())
  13. Hanoi
  14. Yanghui Triangle:
    <pre>
    1
    1 1
    1 2 1
    1 3 3 1
    1 4 6 4 1
    1 5 10 10 5 1
    </pre>

consider every row as a list, using generator to print it out

  1. using map() function to transfer username into formatted name
    input:['adam', 'LISA', 'barT']
    output:['Adam', 'Lisa', 'Bart']:
  2. create a function to calculate the production of each number in the list.
    input:[1, 2, 3, 4]
    output: 24
    hint:using reduce()
  3. filter the palindrome number(123454321)
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 9,786評論 0 23
  • 早上抽到權杖皇后,這個人怎么一點兒也不像皇后?我第一眼看到她,就覺得她是一個男人,面相,身材,神態,無論哪樣都...
    塔羅師默默閱讀 173評論 0 0
  • 人總在得閑 然后就是時間太趕 覺得時間緊迫 萬事如意難 總歸要付出 不是之前 就是以后 忙里偷閑可以 前提是先有忙...
    10086好閱讀 274評論 0 0
  • 網上流傳的另外一則故事:在一個風和日麗的日子,一個富翁到海邊散心,看到一個漁夫悠閑地躺在沙灘上曬太陽,享受日光浴,...
    韌性十足的牛皮糖閱讀 264評論 0 0
  • 在市場上我們經常見到翡翠的人物掛件,可是想要挑選一款質量上乘的翡翠人物掛件,首先需要了解翡翠本身品質的好壞,其次就...
    3cae390c7494閱讀 637評論 0 0