---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:
沒理解這題。主要涉及二分搜索樹的知識(shí)畔派,沒看懂,哭了胞谈。憨愉。。
---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.