Functions

Task1: find_bigger_number()

Write a function find_bigger_number() which takes two numbers and returns the bigger one

In [ ]:
# define the function 'find_bigger_number()' bellow:


# example function call:
bigger = find_bigger_number(2,8)
print( bigger )  

# expected output:
# 8

Lists manipulations

Task1: print positive even numbers

Print only the positive (i.e. > 0) even numbers from a given list

In [ ]:
# given
numbers = [2, -4, -3, 13, 8, -6, 4] 

# your code goes below:


# expected output:
# 2 
# 8 
# 4

Task2: function count_even_positives()

Define a function count_even_positives() which takes as argument a list of numbers, and returns the count of positive (i.e. > 0) even numbers from the given list

In [ ]:
# define the function 'find_even_positives()' bellow:


# example function call:
even_positives_count = count_even_positives( [2, -4, -3, 13, 8, -6, 4] )    

print( even_positives_count )  

# expected output:
# 3

Strings manipulations

Task1: find words starting with 't' or 'T'

Get all words from a given string (for simplicity, just split it on space) and print only the words which starts with 't' or 'T'

In [ ]:
# given is the string:
sentence = '''There is a theory which states that if ever anyone discovers exactly what the 
Universe is for and why it is here, it will instantly disappear and be replaced by something 
even more bizarre and inexplicable. There is another theory which states that this has 
already happened.'''

# get a list of words from string  - use str.split() method with space as separator
# your code goes below:


# loop through words and print only the ones which starts with 'a' or 'A'
# your code goes below:
        
    
# expected output:
# There
# theory
# that
# the
# There
# theory
# that
# this