美文网首页
Python-66~70

Python-66~70

作者: AoEliauk | 来源:发表于2021-01-14 16:32 被阅读0次

---66---

Question:

>Please write a program which accepts basic mathematic expression from console and print the evaluation result.

Example:

>If the following n is given as input to the program:     35 + 3

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

Hints:

>Use eval() to evaluate an expression

Solution:


---67---

Question:

>Please write a binary search function which searches an item in a sorted list. The function should return the index of element to be searched in the list.

Hints:

>Use if/elif to deal with conditions.

Solution:

没理解这题。主要涉及二分搜索树的知识,没看懂,哭了。。。


---68---

Question:

>Please generate a random float where the value is between 10 and 100 using Python module.

Solution:


---69---

Question:

>Please generate a random float where the value is between 5 and 95 using Python module.

Solution:


---70---

Question:

>Please write a program to output a random even number between 0 and 10 inclusive using random module and list comprehension.

Hints:

>Use random.choice() to a random element from a list.


相关文章

  • Python-66~70

    ---66--- Question: >Please write a program which accepts ...

  • 70/70 70

    满打满算写了70天文章,虽然每一篇字数都不是那么多,但是不知不觉累积起来已经超过2万字了。这在以前对于我来说...

  • 致70后……

    尴尬的70后;无奈的70后;辛苦的70后;奔五的70后; 致70后…… 70后的一代,已经站在了40岁的尾巴上。 ...

  • 改变管理----70天计划(90天)

    70天计划(2/70) 1.运动:晨跑(2/70) 2.晚饭不食(2/70) 3.冥想(0/70) 4.阅读(2/...

  • 改变管理------70天计划(89天) - 草稿

    70天计划(1/70) 1.运动:晨跑(1/70) 2.晚饭不食(1/70) 3.冥想(1/70) 4.阅读(1/...

  • 2019-10-01国庆节快乐

    70年风雨兼程 70年砥砺前行 70年沧桑巨变 70年苦难辉煌 ❤祝我伟大祖国70华诞❤️生日快乐!❤ 我爱你中国...

  • 改变------70天计划(91天)

    70天计划(D3) 70天目标: 1.运动:晨跑(3/70) 2.晚饭不食(3/70) 3.冥想(2/70) 4....

  • 认知成长20190215(88天)

    70天计划(/70) 1.运动:晨跑(70) 2.晚饭不食(70) 3.冥想() 20190210 ❤今日️思考问...

  • 70厚,80后

    70比80 数字,70比80少 岁数,70比80老 吃苦,70比80苦 结果,70赢了80 今天和一个成功的高管交...

  • 问痧堂跟师笔记:费景兰2019-10-03

    70年自强不息;70年初心不改, 70年风雨兼程,70年华丽篇章;70年輝煌成就,一路走来,披荆斩棘,砥砺...

网友评论

      本文标题:Python-66~70

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