# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Try what you've learned so far

# Now we have some time fo you to try out Python basics that you've just learned.

# ## 1. Operating and testing scalar types int and float 

# Pizza party!
#
# * Given an number of guests and pizza fraction required per guest
# * Calculate how many pizzas to order
# * Calculate actual pizza fraction per person

# +
from math import ceil  # ceil() rounds up to nearest integer

num_guests = 3
per_person = 1/3

#num_pizzas = 

#print('Order',num_pizzas,'pizzas')
#print('Actual pizzas per person', num_pizzas/(num_guests+1))

# -

# Test Pythagoras Theorem for triangles with sides a, b and c 
#
# > In a right angled triangle:  
# > the square of the hypotenuse is equal to  
# > the sum of the squares of the other two sides

# +
a = 3
b = 4
c = 5

# print('Was Pythagoras right?:', )
# -

# Now try your solution with the values of a, b and c in the next cell. You might need a different solution as hinted below.

# +
from math import isclose

a = 2
b = 2
c = 8**0.5  # this is the same as 
            # c = math.sqrt(8)

# print('Was Pythagoras right?',  )
# -

# ## 2. Explore Booleans

# Booleans can also be constructed using the ``bool()`` object constructor: values of any other type can be converted to Boolean via predictable rules.
# For example, any numeric type is False if equal to zero, and True otherwise:

bool(1)

bool(0)

# The Boolean conversion of ``None`` is always False:

bool(None)

# For strings, ``bool(s)`` is False for empty strings and True otherwise:

bool("")

bool("abc")

# For sequences, which we'll see in the next section, the Boolean representation is False for empty sequences and True for any other sequences

bool([1, 2, 3])

bool([])

# ## 3. Explore Strings

# * Copy a sentence from today's news headline
# * Return the number of words
# * Replace spaces by smilyes 

# your code


# ## 4. Explore Lists

# Store at least 3 different types of objects in a list.

# +
# mylst = [ ]
# -

# Now,
# * append one element
# * modify one element
# * create a new list with the first 2 elements of the previous list
# * create a new list that is the reverse order of the previous list
#



# ### Sequence comprehensions 
#
# * Starting by creating a list of Olympic Games years starting in 1948
# * Create a list with the predicted Football world Cup years, which is held 2 years after each Olympic Games.

# +
olympics = list( range(1948,2020,4 ) )
print( 'Olympics', olympics)

#worldcup = 

# -

# Dictionary comprehension
#
# * Use the dictionary below to create a list of dates that are in the XIX century (>1800).  
#
# Remember to use dictionary method `.values()` to access the years.

# +
Battles= {'Austerlitz':1805,'Alkmaar':1799,'Arhem':1813, 'Arcole':1796,'Jena':1806}

# your code below

# -

# * Use the same dictionary to create a list of Battle names that are in the XIX century (>1800). 
#
# Other dictionary methods are `.items()` and `.keys()`
#

# ## 5. Dictionary attributes

# Remember dictionaries
dict(a='123', say='hellozles', other_key=['wow', 'a', 'list', '!'], and_another_key=3.14)

# Store the following information in a dictionary:
#     pet's name, age, colour and weight

# +
# mypet = {'name':    }
# -

# Modify one of the values and add a new attribute, species



StarcoderdataJupyterScriptsDedupFiltered