









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Overview Understanding data types How to use variables Seeing what you can do with strings How to manipulate a string Coding a program that prints receipts Writing Comments we can write comments using the hash (#) symbol
print("Hello") # this is also a comment What Are Data Types? Data types are how we define values, likes words or numbers.
The Print Statement Integers Floats
Booleans
Integer and Float Variables Boolean Variables String Variables Using Multiple Variables Using Operators on Numerical Variables
Overwriting Previously Created Variables Whitespace Whitespace just means characters which are used for spacing and have an “ empty ” representation. name = 'John Smith' Exercise String Concatenation
String Index String Slicing Slicing is essentially when you only want a piece of the variable, such that if I only wanted “He” from the word “Hello”, we would write the following: >>> variable_name[ start : stop : step ] .title( ) The title method capitalizes all first letters in each word of a string .replace( )
.find( )
.strip( ) In cases where you want to get rid of a certain character on the left and right side of a string, you would use the strip method. By default, it will remove spaces .split( )
Displaying the Company Info Create a divider: Displaying the Product Info
Displaying the Total section border: Displaying the Ending Message Displaying the Bottom Border
Converting User Input If Statements Checking User Input Logical Operator “and”
Logical Operator “or” The “or” logical operator is used to check for one or both conditions to be true Logical Operator “not” Practice Question Q Q