{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#Advanced Python Objects Test" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Advanced Numbers\n", "\n", "**Problem 1: Convert 1024 to binary and hexadecimal representation:**" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Problem 2: Round 5.23222 to two decimal places**" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Advanced Strings\n", "**Problem 3: Check if every letter in the string s is lower case**" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "s = 'hello how are you Mary, are you feeling okay?'\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Problem 4: How many times does the letter 'w' show up in the string below?**" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "s = 'twywywtwywbwhsjhwuwshshwuwwwjdjdid'\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Advanced Sets" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Problem 5: Find the elements in set1 that are not in set2:**" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [], "source": [ "set1 = {2,3,1,5,6,8}\n", "set2 = {3,1,7,5,6,8}\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Problem 6: Find all elements that are in either set:**" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Advanced Dictionaries\n", "\n", "**Problem 7: Create this dictionary:\n", "{0: 0, 1: 1, 2: 8, 3: 27, 4: 64}\n", " using dictionary comprehension.**" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Advanced Lists\n", "\n", "**Problem 8: Reverse the list below:**" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "l = [1,2,3,4]\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Problem 9: Sort the list below**" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [], "source": [ "l = [3,4,2,5,1]\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#Great Job!" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.10" } }, "nbformat": 4, "nbformat_minor": 0 }