Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Directions you will be practicing your new skills with operators, string concatenation, and control flow. For this project, you will be creating a new directory,

Directions

you will be practicing your new skills with operators, string concatenation, and control flow. For this project, you will be creating a new directory, so please follow the below setup instructions.

Setup

First, open up your command prompt/terminal

Within your command prompt/terminal, run the following command:

cd desktop 

Next, run the following:

cd python_course 

Run the following to create a new directory for this project:

mkdir lesson_two_handson 

Open up a new window in VSCode.

Click on the "Explorer" button on the left-hand side of the VSCode window.

Click the Open Folder button.

Select the lesson_two_handson directory within the python_course folder on your Desktop. Click the Open button.

Create a new file named main.py by one of the following three ways:

To the right of LESSON_TWO_HANDSON in the EXPLORER is a button that looks like a piece of paper with a plus symbol in its top-left corner. If you hover your mouse over this button for a moment, a popup will appear indicating that this button will create a new file.

Choose File > New File from the app's menu.

Press Control + N in Windows or Command + N on a Mac (the plus means "and at the same time").

Now you are ready to get started on your Lesson 2 Hands-On!

Requirements

This hands-on is broken into three parts. Please complete each part within your main.py file.

Part 1

Create a program that will concatenate string variables together to form your birthday.

Create three variables named day, month and year

Concatenate each of these variables to create your full birthday.

Hint! You cannot concatenate strings and integers, so all variables will need to be strings

Assign the concatenation to a fourth variable named my_birthday.

Finally, print the variable my_birthday to see if you have the format identical to the one in the example below:

For example, if your birthday is on November 11th of 1991, then the format/output should be November 11, 1991

Tip!

To add spaces between each word as you concatenate them, use double quotes with a space in between them like so: " ".

Part 2

Concatenate the variables first, second, third, and fourth and set this concatenation to the variable final:

first = "happy" second = "birthday" third = "to" fourth = "you" final = 

Print the final variable, but all words should be uppercase.

Run this code in the VSCode terminal.

The output should be HAPPY BIRTHDAY TO YOU.

Part 3

Finally, add code to your program that determines if the given age allows the attendee to see the movie, printing out a specific message based on the age. There should be four possible outputs:

If under the age of 10, print Not permitted

If under the age of 15, print Permitted with a parent

If under the age of 18, print Permitted with anyone over 18

If 18 or over, print Permitted to attend alone

Below is some code to get you started:

age = 15 if 

Tip!

You made need more than one elif statement to capture each condition, and the sequence matters.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions