Lab 1 practice.pdf - Lab 1 practice Python Basics Overview...

This preview shows page 1 - 7 out of 15 pages.

Lab. 1 practice Python Basics 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 # this is a comment 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 Yes or No Booleans
Strings Variables We declare a name on the left side of the equals operator (“ = ”) >>> first_name = " John "
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
.format( ) f Strings By putting the letter f ” in front of a string, you’re able to inject a variable into a string directly in line.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture