Python Basics: By: Asif Surti
Python Basics: By: Asif Surti
B Y: A S I F S U R T I
PRINTING IN PYTHON
• for example
• print(“Hello!”) prints Hello on the screen.
• Try this code!
• print(“Hello!”)
• print(“Hi!!!”) prints Hi on the screen
• Please do a few more print statements
• e.g. print (1000)
• print(“Good day!”)
• print(“My name is Dawood”)
DIFFERENT KINDS OF DATA
• Students information:
• Name: Ibrahim
• Roll No: 20
• Class 6
• name = “asif”,
• last_name = “surti”
• brand = “apple”
• and so on
• Exercise: Please define 5 variables and assign values to it and print them.
QUOTES
• “Dhaval”
• ‘Tanay’
PYTHON STRING VARIABLES
• a = “Hello “
• b = “Tuesday”
• car_name = “Maruti” etc.
• a = 20.0001
• roll_no = 36
• weight = 23.3 etc.
• num1 = 20
• print(num1)
• days_in_week = 7
FLOATING DATA TYPE
• # a= 100
ARITHMETIC WITH NUMBERS
• Operators
• + # Addition
• - # Subtraction
• * # Multiplication
• / # Division
• % # Modulus operator returns the remainder
• ** # Exponentiation
• Examples
• # Number of hours in 1 month
• print(24*30)
• # Average of 10 numbers
• print( (5+20+12+23+45+12+43+23+12+34)/10 )
ARITHMETIC WITH NUMBERS
• today = “Tuesday”
• print(f”Weekday is {today}”)
COMMENTS IN PYTHON
• print(f“School is {school}”)
TYPE OF DATATYPE
• first_name = “asif”
• last_name = “surti”
• full_name = first_name+last_name
• print(full_name)
OTHER DATA TYPES
• num1==num2
• See what the computer prints!
LISTS
• element = num[2]