Python Pro

Concatenation

Concatenation: Combining 2 or more strings to form a single string of characters.


# Concatenation Example

def main(): word1 = "My"

word2 = "program"

word3 = "is the best!"

print(word1 + " " + word2 + " " + word3)

main()


Program: Follow this example to see how the plus symbol (+) makes concatenation happen.

Setting Up the Variables: Here three variables are assigned a different string value.

Concatenation: This print statement uses the plus symbol (+) to combine all three string values into one to display. Notice the extra quotations in the print statement. This adds a space between each word.

Understanding List Syntax

# List Example

def main():

    partyToDoList = ["buy food", "plan games", "decorate", "send invites", "have fun!"]


    print(partyToDoList)


    partyToDoList.append("cook food")


main()

Create a List: The brackets [] tells Python that it is creating a list. Notice that everything in this list is a string, and the strings appear in quotation marks "". This tells Python that each item is a string.

Append a List: To append to a list, type the name of the variable and add .append(). In this case we are adding the string "cook food". The value in the parentheses will be added to the end of the existing list.

The list will now say buy food, plan games, decorate, send invites, have fun, cook food.

# More List Examples

def main():

    list1 = [1, 5, 7, 3]
    list2 = [4, 6, 9, 4]

    list3 = list1 + list2 

    print(list3)

    list3.sort()


main()

Combine Lists: The plus symbol (+) is used to combine two lists into a single variable, list3, that contains all the values.

Sort a List: The sort() function will sort the given list in ascending order (lowest to highest).

Lists can be sorted using the sort() function. The sort() function sorts the list ascending by default. The print() function will display the values of the list alphabetically.
Project Manager: Has the overall responsibility for successful planning, executing, and completing a project.

Budget: The estimated amount of money needed to complete a project.

Scope: The project manager oversees the overall work in a project. If the scope increases, this is called ‘scope creep’ and could negatively impact the cost and timeline of a project.

Money: Once the project manager estimates the scope of the project, he or she must figure out the budget to deliver a quality product.

Analysis: Project managers must analyze the possible risks of a project, including inaccurate scope, insufficient resources, and missed deadlines. Frequent meetings with team members can help project managers analyze potential risks.

Resources: Resources can be people, equipment, facilities, money, or anything else required for the completion of a project. Project managers are responsible for selecting the most efficient resources.

Time: Project managers know the importance of time, so they create project timelines that include specific deadlines and communicate these expectations with the team.