forked from vitekzkytek/PythonDataIES
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:vitekzkytek/PythonDataIES
- Loading branch information
Showing
1 changed file
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Seminar 1\n", | ||
"\n", | ||
"by Martin Hronec\n", | ||
"\n", | ||
"(27th of February)" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### input\n", | ||
"* prompt the user for their name and age \n", | ||
"* then calculate the year in which the user will turn 100 years old and print the result.\n", | ||
"\n", | ||
"```\n", | ||
"What is your name? John\n", | ||
"What is your age? 30\n", | ||
"John, you will turn 100 years old in the year 2090.\n", | ||
"```\n", | ||
"\n", | ||
"**Hint** use `input()` and `datetime.datetime.now()` methods" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### For loops\n", | ||
"* print multiplication table from 1 to 10" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Merge dictionaries\n", | ||
"Create 2 different dictionaries and merge them." | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Conditionals\n", | ||
"\n", | ||
" Calculate income tax for the given income by adhering to the below rules:\n", | ||
" * first 5k, tax rate 0%\n", | ||
" * next 10k, tax rate 10%\n", | ||
" * remainning, tax rate 20%\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Comprehensions\n", | ||
"\n", | ||
"1. Write a Python program that takes a list of numbers and creates a dictionary where the keys are the numbers and the values are their squares.\n", | ||
"2. Take the dictionary from the part above, and changes keys for values (and vice versa) using list comprehension.\n", | ||
"3. Create new dictionary by changing values from dictionary above to be strings containning original number followed with letter \"p\". Keys should remain the same." | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Dictionary manipulation\n", | ||
"\n", | ||
"1. Create a dictionary of 1000 students. Keys should be random strings of lenght 5 containning random characters and values should be random grades (from 1 to 5). \n", | ||
"**Hint**: use module `string` and module `random`\n", | ||
"2. Modify functionality written in the point above so that keys are random string of lengths from 3 to 10\n", | ||
"3. Write a program that takes a dictionary of student names and their grades from the 1st part and calculates the average grade for the class\n", | ||
"4. Also calculate number of times each grade has occurred." | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Functions\n", | ||
"\n", | ||
"Turn what you've done in the previous exercise into functions. Don't write one monotholic function, split it logically." | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Thinking stretching\n", | ||
"\n", | ||
"* Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.\n", | ||
"* You may assume that each input would have exactly one solution, and you may not use the same element twice.\n", | ||
"* You can return the answer in any order." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3.10.7 64-bit", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.7" | ||
}, | ||
"orig_nbformat": 4, | ||
"vscode": { | ||
"interpreter": { | ||
"hash": "1f0e6d99f3103fd78365fe1cf7b2d51239fa0878786db9cbdfe89bc88a3151d3" | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |