{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 1\n", "Create a string using single-quotes that says 'This is my first string!' and store it in a variable called 'string'." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 2\n", "Create a string using double-quotes that says 'My second string has arrived!' and store it in a variable called my_second_string." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 3\n", "Create a multi-line string with a different pizza ingredient on each line. Store it in a variable called pizzaIngredients." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 4\n", "Concatenate str1 and str2 in the code cell below. Put a space between them when you concatenate them." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "str1 = 'Houston'\n", "str2 = 'Texas'\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 5\n", "Print cowboy_string 5 times." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "cowboy_string = 'Yeehaw! '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 6\n", "Using string interpolation, using the following variables to write the sentence 'The 44th President of the United States was Barack Obama'." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "presidentFirstName = 'Barack'\n", "presidentLastName = 'Obama'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 7\n", "Print the 6th character of the following string." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "string = 'aosiudhaoughoahfoihaoisf'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 8\n", "Print the last character of the following string." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "another_string = 'cdbghrftghyjtfghyj'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 9\n", "Print the second-last character of the following string." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "longWord = 'supercalifragilisticexpialidocious'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 10\n", "Calculate the length of the following string." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "barbecueSauce = \"Frank's Red Hot!\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 11\n", "Transform the following string to uppercase letters and print the modified string." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "string_to_modify = 'this should be all uppercase'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 12\n", "Transform the following string to lowercase letters and print the modified string." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "another_string_to_modify = 'THIS SHOULD BE ALL LOWERCASE'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 13\n", "Replace all of the 'i' characters with 'y' characters in the following string." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "sentence = \"This is a sentence whose i's will be replaced with y's.\"" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.6" } }, "nbformat": 4, "nbformat_minor": 4 }