Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 976 Bytes

week-1.md

File metadata and controls

55 lines (42 loc) · 976 Bytes

Week 1 Notes

Strings

  • String variables are defined using two "s around the text

Variables

A variable is a representation which can contain data of ANY type in Python.

Variable Assignment

Example:

my_name = "Ehmad Zubair"

String manipulation

Two strings can be added using a + sign.

Example:

my_full_name = "Ehmad Zubair " + "Chughtai"

Numbers manipulation

Numbers are of two types:

  • int
  • float

Numbers are manipulated using very basic characters +,-,*,/

Example:

addition_result = 5 + 9
subtraction_result = 12 - 3

Data Types

  • String
  • Number
  • Boolean

Help: If you don't know the type of a variable, use type(variable_name) to see what type it is.

User Input

  • input() is used to get user input from the keyboard

Conditional Operators

  • is equal to ==
  • is greater than >
  • is greater than or equal to >=
  • is less than <
  • is less than or equal to <=
  • and
  • or

Loops