- Test installation and pycharm
- Python is a Dynamically typed language
print("Hello Engineering 89")
First_Name = "Shahrukh"
Last_Name = "Khan"- Let's create a variable to store int value
Salary = 10.5 # float value
age = 19 # int value
my_age = "22"
print(First_Name)
print(Last_Name)
print(Salary)
print(age)
print(my_age)print(type(age)) # will print the type of variable age
print(type(my_age)) # will print the type of variable age
# input() in python to interact with user - to ask user to enter required data
User_Name = input("Please Enter Your Name ")
print("Hello ")
print(User_Name)
print(input("Please enter your Name "))- variables first_name, last_name, age, DOB
- prompt user to input above value
- print/display the type of each value received from the user
- then display the data back to user with greeting message
Data types are the core of all programming languages. After all, if there is no data there is not a program.
Through the next few lessons we will be learning about all many of the data types available and more importantly some of the inbuilt methods around these data types that we can guarantee will be valuable to you as you progress.
Overall there are three high level data types that will be used:
- Numbers -> integers, longs, double, floating point numbers, etc.
- Strings -> Essentially any text
- Boolean (true & false)
We are very confident in saying that there is not a program anywhere that does not use, receive or deliver at a minimum one of the above data types.
Operands are symbols that execute a particular mathematical or logical function and we will be using as many as possible throughout the lessons we will get around to using a large amount of them.
| Operand | Description | Example |
|---|---|---|
| + | add two operands (variables) together | X + y + 2 |
| - | subtract two operands (variables) | X - y - 2 |
| * | multiply two operands (variables) | X - y - 2 |
| / | divide two operands (variables) | X - y - 2 |
| % | Modulus - remainder of the division of left operand by the right | X - y - 2 |
| + | add two operands (variables) together| X + y + 2 |
| Operand | Description | Example |
|---|---|---|
| > | True if left operand is greater than the right | x > y |
| < | True if left operand is less than the right | x < y |
| == | True if both operands are equal | x == y |
| != | True if both operands are equal | x != y |
| >= | True if left operand is greater than or equal to the right | x >= y |
| <= | True if left operand is less than or equal to the right | x <= y |
Theses are just some of the examples and we will use many of them over this course.
- Let's practice
number_1 = 4
number_2 = 2
print(number_1 + number_2) # adding 2 values
print(number_1 - number_2) # subtracting 2 values
print(number_1 * number_2) # multiply
print(number_1 / number_2) # divide
print(number_1 % number_2) # remainder value
print(number_1 ** number_2)
# Let's look at boolean values
num1 = 4
num2 = 2
print(num1 <= num2) # is num1 less than equals to num2
print(num1 == num2) # is number_1 equals number_2? not true/False
print(num1 != num2) # is number_1 not equal to number_2
print(num1 >= num2) # is num1 greater than num2 - True