Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Homework #2 Mortal Combat
- ## Preface
- No console input this time. Do it all with hardcoded values.
- ## Problem 1
- Write a function that returns the largest element in a list.
- Your program should work like this:
- ~~~python
- ## INPUT
- find_largest_in_list([1,2,3,4,5,99,1,3])
- ## OUTPUT
- 99
- ~~~
- ---
- ## Problem 2
- Write function that reverses a list, preferably in place.
- Your program should work like this:
- ~~~python
- ## INPUT
- reverse([1,2,3,4])
- ## OUTPUT
- [4,3,2,1]
- ~~~
- ---
- ## Problem 3
- Write a function that checks whether an element occurs in a list.
- ~~~python
- ## INPUT
- find_in_list([1,2,3,4],3)
- ## OUTPUT
- True
- ~~~
- ---
- ## Problem 4
- Write a function that computes the list of the first 100 Fibonacci numbers.
- ~~~python
- ## OUTPUT
- 1,2,3,5 ...
- ~~~
- ---
- ## Problem 5
- Write a function that tests whether a string is a palindrome.
- ~~~python
- ## INPUT
- palindrome("racecar")
- ## OUTPUT
- True
- ~~~
Add Comment
Please, Sign In to add comment