# Lesson 5.1 π Functions Practice

## Maximum Value

Write a function, `max_value`, that takes in an integer and prints the numbers from 1 to that number inclusively.

## Beyond Compare

Write a function, `compare_lists`, that given two lists of numbers the same length, compares each element of the lists, and print out the higher value at each index.

``````list1 = [4,5,15,11,23,42]
list2 = [1,8,7,16,7,35]

compare_lists(list1, list2)
# 4 8 15 16 23 42 should print out
``````

## Stars

Write a function, `swapping_stars`, that will print out the following:

``````* - * - * -
- * - * - *
* - * - * -
- * - * - *
* - * - * -
- * - * - *
``````

## `is_even`

1. Define a function is_even that will take a number x as input.
2. If x is even, then return True.
3. Otherwise, return False.

## `is_int`

1. Define a function `is_int` that takes a number `x` as an input.
2. Have it `return True` if the number is an integer (as defined above) and `False` otherwise.
``````# For example

is_int(7.0)   # True
is_int(7.5)   # False
is_int(-1)    # True
``````

## `digit_sum`

Write a function called `digit_sum` that takes a positive integer `n` as input and returns the sum of all that numberβs digits.

For example: `digit_sum(1234)` should return `10` which is `1 + 2 + 3 + 4`.

(Assume that the number you are given will always be positive.)

## Rectangle

Write a function called `rectangle`. It takes two numbers as user input, and prints a rectangle.

It should look like this:

``````Enter width: 5
Enter height: 10
*****
*****
*****
*****
*****
*****
*****
*****
*****
*****
``````