Friday, March 11, 2022

学习笔记 - Python

最近在Coursera上课。 台湾的课程:用Python做商管程式设计(一)(Programming for Business Computing in Python (1))。想说最近写程序很夯,挑战看看

没有专门下载Python,只是在colab.research.google.com/直接写了(用大姐的电脑)

目前才上到week 3的课程。 虽然课堂上老师讲的东西,看似简单,容易明白。等到自己要亲自动手写,从无到有,要做功课和作业时,才头痛。

想在这里记录一下 Week 3 做的作业。题目在这里就不多提了。主要就是想说--可能其实有更简单的方法写,只是身为一个程序小白,刚刚学会 assignment =, comparison ==, if, else, else if, nested if else...

我只会用最直白的方式写出来。这题的output有63种组合,我就傻傻的一个一个的写...... 写了200多行。(不重要的题外话:问题要的是“,”, 我写了“:”)虽然答题还是可以的,但假如是在真的考场有时间上的压力的话,做了这题就别想做其他题目了,已经耗尽了全部能量和精力。




spend = int(input())

give = 1000
totalchange = give - spend

c500 = int()
c100 = int()
c50 = int()
c10 = int()
c5 = int()
c1 = int()

c500 = (totalchange)//500
c100 = (totalchange%500)//100
c50 = ((totalchange)%100)//50
c10 = (totalchange%100%50)//10
c5 = (totalchange%10)//5
c1 = (totalchange%10%5)//1

print("total change: ", totalchange)

if (c500 == 0):
    if (c100 == 0):
        if (c50 == 0):
            if (c10 == 0):
                if (c5 == 0):
                    if (c1 != 0):
                      print ("1: " + str (c1)) #1-4
                else:
                    if (c1 != 0):
                        print ("5: " + str(c5) + "; 1: " + str(c1)) #6-9
                    else:
                        print ("5: " + str(c5)) #5
            else:
                if (c5 == 0):
                    if (c1 == 0):
                        print ("10: " + str(c10)) # 10, 20, 30, 40
                    else:
                        print ("10: " + str(c10) + "; 1: " + str(c1)) #11-14, 21-24,31-34, 41-44
                else:
                    if (c1 == 0):
                        print ("10: " + str(c10) + "; 5: " + str(c5)) #15, 25, 35, 45
                    else:
                        print ("10: " + str(c10) + "; 5: " + str(c5) + "; 1: " + str(c1)) #16-19, 26-29, 36-39, 46-49
        else:
            if (c10 == 0):
                if (c5 == 0):
                    if (c1 == 0):
                        print ("50: " + str(c50)) # 50
                    else:
                        print ("50: " + str(c50) + "; 1: " + str(c1)) # 51-54
                else:
                    if (c1 == 0):
                        print ("50: " + str(c50) + "; 5: " + str(c5))# 55
                    else
                        print ("50: " + str(c50) + "; 5: " + str(c5) + "; 1: " + str(c1)) #56-59
            else
                if (c5 == 0):
                   if (c1 == 0):
                       print ("50: " + str(c50) + "; 10: " + str(c10))
                   else :
                       print ("50: " + str(c50) + "; 10: " + str(c10) + "; 1: " + str(c1))
                else
                   if (c1 == 0):
                       print ("50: " + str(c50) + "; 10: " + str(c10) + "; 5: " + str (c5))
                   else
                       print ("50: " + str(c50) + "; 10: " + str(c10) + "; 5: " + str (c5) + "; 1: " + str(c1))
    else
        if (c50 == 0):
            if (c10 == 0):
                if (c5 == 0): 
                    if (c1 == 0):
                        print ("100: " + str (c100))
                    else :
                        print ("100: " + str (c100) + "; 1: " + str (c1))
                else :
                    if (c1 == 0):
                        print ("100: " +str (c100) + "; 5: " + str (c5))
                    else :
                        print ("100: " +str (c100) + "; 5: " + str (c5) + "; 1:" + str (c1))
            else:
                if (c5 == 0):
                   if (c1 == 0):
                       print ("100: " + str (c100) + "; 10: " + str (c10))
                   else
                       print ("100: " + str (c100) + "; 10: " + str (c10) + "; 1: " + str (c1)) 
                else
                    if (c1 == 0):
                        print ("100: " + str (c100) + "; 10: " + str (c10) + "; 5: " + str (c5))
                    else
                        print ("100: " + str (c100) + "; 10: " + str (c10) + "; 5: " + str (c5) + "; 1: " + str (c1))
        else:
              if (c10 == 0):
                  if (c5 == 0): 
                      if (c1 == 0): 
                          print ("100: " +str (c100) + "; 50: " + str (c50))
                      else:
                          print ("100: " +str (c100) + "; 50: " + str (c50) + "; 1: " + str (c1))
                  else
                      if (c1 == 0):
                          print ("100: " +str (c100) + "; 50: " + str (c50) + "; 5: " + str (c5))
                      else
                          print ("100: " +str (c100) + "; 50: " + str (c50) + "; 5: " + str (c5) + "; 1: " + str (c1))
              else
                    if (c5 == 0): 
                        if (c1 == 0):
                            print ("100: " +str (c100) + "; 50: " + str (c50) + "; 10: " + str (c10))
                        else
                            print ("100: " +str (c100) + "; 50: " + str (c50) + "; 10: " + str (c10) + "; 1: " + str (c1))
                    else
                         if (c1 == 0): 
                             print ("100: " +str (c100) + "; 50: " + str (c50) + "; 10: " + str (c10) + "; 5: " + str (c5))
                         else
                            print ("100: " +str (c100) + "; 50: " + str (c50) + "; 10: " + str (c10)  + "; 5: " + str (c5) + "; 1: " + str (c1))
else:
    if (c100 == 0):
        if (c50 == 0): 
            if (c10 == 0): 
                if (c5 == 0): 
                    if (c1 == 0): 
                        print ("500: " + str (c500))
                    else :
                        print ("500: " + str (c500) + "; 1: " + str (c1))
                else
                    if (c1 == 0): 
                        print ("500: " + str (c500) + "; 5: " + str (c5))
                    else
                        print ("500: " + str (c500) + "; 5: " + str (c5) + "; 1: " + str (c1))
            else:
                if (c5 == 0):
                    if (c1 == 0):
                      print ("500: " + str (c500) + "; 10: " + str (c10))
                    else :
                        print ("500: " + str (c500)  + "; 10: " + str (c10) + "; 1: " + str (c1))
                else
                    if (c1 == 0): 
                        print ("500: " + str (c500) + "; 10: " + str (c10)  + "; 5: " + str (c5))
                    else
                        print ("500: " + str (c500) + "; 10: " + str (c10)  + "; 5: " + str (c5) + "; 1: " + str (c1))
        else#got 500, got 50
            if (c10 == 0):
                if (c5 == 0): 
                    if (c1 == 0):
                        print ("500: " + str (c500) + "; 50: " + str (c50))
                    else
                        print ("500: " + str (c500) + "; 50: " + str (c50) + "; 1: " + str (c1))
                else
                    if (c1 == 0):
                        print ("500: " + str (c500) + "; 50: " + str (c50) + "; 5: " + str (c5))
                    else
                        print ("500: " + str (c500) + "; 50: " + str (c50) + "; 5: " + str (c5) + "; 1: " + str (c1))
            else# got 500, got 50, got 10
                  if (c5 == 0):
                      if (c1 == 0):
                          print ("500: " + str (c500) + "; 50: " + str (c50) + "; 10: " + str (c10))
                      else:
                          print ("500: " + str (c500) + "; 50: " + str (c50) + "; 10: " + str (c10) + "; 1: " + str (c1))
                  else#got 500, got 50, got 10, got 5 
                      if (c1 == 0): 
                          print ("500: " + str (c500) + "; 50: " + str (c50) + "; 10: " + str (c10) + "; 5: " + str (c5))
                      else
                          print ("500: " + str (c500) + "; 50: " + str (c50) + "; 10: " + str (c10) + "; 5: " + str (c5) + "; 1: " + str (c1))
    else# got 500, got 100
      if (c50 == 0): 
          if (c10 == 0): 
              if (c5 == 0): 
                  if (c1 == 0): 
                      print ("500: " + str (c500) + "; 100: " + str (c100)) 
                  else:
                      print ("500: " + str (c500) + "; 100: " + str (c100) + "; 1: " + str (c1) )        
              else
                  if (c1 == 0): 
                      print ("500: " + str (c500) + "; 100: " + str (c100) + "; 5: " + str (c5))    
                  else
                      print ("500: " + str (c500) + "; 100: " + str (c100) + "; 5: " + str (c5) + "; 1: " + str (c1))
          else# got 500, got 100, got 10
                if (c5 == 0):
                    if (c1 == 0): 
                        print ("500: " + str (c500) + "; 100: " + str (c100) + "; 10: " + str (c10))
                    else:
                        print ("500: " + str (c500) + "; 100: " + str (c100) + "; 10: " + str (c10)  + "; 1: " + str (c1))
                else:
                    if (c1 == 0): 
                        print ("500: " + str (c500) + "; 100: " + str (c100) + "; 10: " + str (c10)  + "; 5: " + str (c5))
                    else:
                        print ("500: " + str (c500) + "; 100: " + str (c100) + "; 10: " + str (c10) + "; 5: " + str (c5) + "; 1: " + str (c1))
      else# got 500, got 100, got 50
          if (c10 == 0):
              if (c5 == 0):
                  if (c1 == 0):
                      print ("500: " + str (c500) + "; 100: " + str (c100) + "; 50: " + str (c50))
                  else
                      print ("500: " + str (c500) + "; 100: " + str (c100) + "; 50: " + str (c50) + "; 1: " + str (c1))
              else
                  if (c1 == 0): 
                      print ("500: " + str (c500) + "; 100: " + str (c100) + "; 50: " + str (c50) + "; 5: " + str (c5))
                  else
                      print ("500: " + str (c500) + "; 100: " + str (c100) + "; 50: " + str (c50)  + "; 5: " + str (c5) + "; 1: " + str (c1))
          else# got 500, got 100, got 50, got 10
                if (c5 == 0):
                    if (c1 == 0): 
                        print ("500: " + str (c500) + "; 100: " + str (c100) + "; 50: " + str (c50)  + "; 10: " + str (c10))
                    else:
                        print ("500: " + str (c500) + "; 100: " + str (c100) + "; 50: " + str (c50)  + "; 10: " + str (c10) + "; 1: " + str (c1))
                else:
                    if (c1 == 0):
                        print ("500: " + str (c500) + "; 100: " + str (c100) + "; 50: " + str (c50)  + "; 10: " + str (c10)  + "; 5: " + str (c5))
                    else
                        print ("500: " + str (c500) + "; 100: " + str (c100) + "; 50: " + str (c50)  + "; 10: " + str (c10)  + "; 5: " + str (c5) + "; 1: " + str (c1))

Thursday, December 9, 2021

分享旅游图片 + 乱乱画画 👉 香港大屿山

用新iPad的sketchbook画了几张在香港、澳门和广州的一些著名景点。 是在2015年尾去的香港。
用我非常不会画画的手,利用App的layer技术,照着画而已。还在explore这个app其它功能中。
大屿山不只有大佛,还有宝莲禅寺、 心经简林、昂坪市集。昂坪缆车也是那里的卖点之一。



心经简林 - 路上下了雨,还好有带伞



不坐缆车的话,行山是另一个选项。

在宝莲寺的珍味素吃午餐。也在市集吃了豆腐花和芝麻糊。





Tuesday, August 24, 2021

加强防疫

最近公司比较加强了防疫措施。 不单每天把确诊数字发在群里,还在几乎每个门旁都加了hand sanitizer。 
虽然我们贴了不让"非必要人员进入",但是完全没有人理会。 会进来的还是会进来...... (即使他只是要洗进来个手(但又不用肥皂的洗手))

每个星期做RTK test。 
让大家尽量不跨部门, 开始使用了后面不常用的厕所。 要有锁匙才可以进去(虽然也是3个部门在共用😱)

还加了几台净水机,虽然我们只有这个...... (好过没有啦)


开会也用zoom了。

今天还分了一人一个布口罩。

吸烟区怕人潮聚集也用网遮起来了。

Covid19 你几时才肯离开?

Thursday, August 19, 2021

坚持住

今天才第二天开始练韩语,已经开始厌烦了。 写到一半,忍不住开小差,划起了facebook。我能坚持几天呢??

今天33个生字,有好几个文具生字是以前学过的,剩下的要好好背下来才行啊~



Wednesday, August 18, 2021

学韩语

久违的写blog, 久违的(第N次)学韩语(每次都3分钟热度,一切靠心血来潮。

下载了在syokapp 被介绍的Apps - 韩语单词 (HuaweiApp Gallery 才有, play store 没有)。Refresh 一下生字,练习一下手感。 原本写在废纸上, 过后写在 旧 Ipad (ipad 2)(10年了,是大姐以前旧的)。 用 Topnotes app来写(还是用手画的)。可是又吝啬,不升级Pro版本,不能直接share,还是用screenshot弄出来。 
想直接用ipad谢blog, 结果safari和chrome都好像也过期了,support不到,写不到。
最后还是email照片去手机,再用手机写blog, upload 今天学习的内容。 
真是坎坷啊。 
最近我的instagram一直看人家用ipad, 用goodnotes5。 搞得我心痒痒也想买新ipad回来😱
人家是用来学习上课, 画画, 写手帐。 我最多是用来看戏罢了。 学习可能又是另一个3分钟热度的事情。 之前看人家写电子手账,我也学了(用Mori Journal) 。 现在也快3个星期了, 才有5张,已经没力气弄了...... 







用Mori Journal的template做的,用来记单词, 是满赏心悦目的啦


Friday, April 30, 2021

欢喜火锅 @ Autocity (30.4.2021)

为了帮Mr Andy庆祝生日去了欢喜火锅吃自助餐。4月有4人同行1人免费



旁边墙上还有两台电视

5个人 选了 '欢喜王牌套餐' RM234
香港罗宋汤 RM10
招牌麻辣烫 RM10
港式沙爹底 RM10
港式高汤 Free
扣 RM51.48
Service charge 10% = RM21.72
Total = RM 238.90

感觉虾滑没有很滑... 点花蟹有给小剪刀(贴心)。 菜的选择好像也没有太多(没有我想吃的broccoli) 。

不过有烧卖,咖喱鱼蛋,碗仔翅(吃后感觉有放味精)(酱料区没看到醋,也不特别找了直接吃,所以可能味道只是还好,不会想再吃第二碗)(就这些比较有给我港式的feel) (珍奶好像要另外给钱的)

超全 @ Raja Uda (30.4.2021)

Service完车后去吃超全(早午餐)