美文网首页
Python-56~60

Python-56~60

作者: AoEliauk | 来源:发表于2020-10-30 10:44 被阅读0次

---56---

Question:

>Print a unicode string "hello world".

Hints:

>Use u'strings' format to define unicode string.

Solution:


---57---

Question:

>Write a program to read an ASCII string and to convert it to a unicode string encoded by utf-8.

Hints:

>Use unicode()/encode() function to convert.

Solution:


---58---

Question:

Write a special comment to indicate a Python source code file is in unicode.


---59---

Question:

>Write a program to compute 1/2+2/3+3/4+...+n/n+1 with a given n input by console (n>0).

Example:

>If the following n is given as input to the program:   5

>Then, the output of the program should be:   3.55

Hints:

>Use float() to convert an integer to a float.Even if not converted it wont cause a problem because python by default understands the data type of a value

Solution:


---60---

Question:

>Write a program to compute:   f(n)=f(n-1)+100 when n>0

and f(0)=0

>with a given n input by console (n>0).

Example:

>If the following n is given as input to the program:    5 

>Then, the output of the program should be:     500

 Hints:

>We can define recursive function in Python.

Solution:


相关文章

  • Python-56~60

    ---56--- Question: >Print a unicode string "hello world"....

  • 60/60

    今天本来是记录了参加活动的事情,但是想到计划写60篇随手记,于是就继续写了这段记录。 希望自己的记录一般在1000...

  • 邓思齐作品

    60×80cm 30×40cm 50×60cm 60×80cm 60×80cm 60×80cm 60×80cm 2...

  • 无标题文章

    祎天作品 花卉50*60 花卉50*60 花卉50*60 花卉50*60 花卉50*60 ! 花卉 牧归24*24...

  • 2018-04-06

    60*60 9块 30*60 10块 条子4根

  • 20181111abby健身记录

    1.4组箭步蹲.60个 2.4组硬拉,60个 3.负重臀桥.4组.60个,静态臀桥.60秒。 4.腿部.4组.60...

  • js倒计时

    1天=24h60mm60s1000ms1h=60mm60s1000ms1分钟=60s1000ms1s=1000ms

  • Android时间工具类二(自定义CountDownTimer倒

    说到倒计时,首先了解一下关系。方便你的理解 一天=24小时 =24*60分钟=24*60*60秒=24*60*60...

  • 八珍糕

    可健脾胃———配方如下: 党参30g 白术20g 茯苓60g 芡实60g 淮山药60g 莲子肉60g 薏米60g ...

  • 计数

    300+3小时*60*60+

网友评论

      本文标题:Python-56~60

      本文链接:https://www.haomeiwen.com/subject/mkmxvktx.html