Python Programming Notes - Part 2
Input in Python
input() statement is used to accept values (using keyboard) from user
• string input (words / sentences)
name = input("name : ")
Output / Execution Visual:
name : Shradha
Memory Box: name -> ["Shradha"]
• int input
age = int(input("age : "))
Output / Execution Visual:
age : 23
Memory Box: age -> [23]
• float input
price = float(input("price : "))
Output / Execution Visual:
price : 23.5
Types of Operators
• Arithmetic Operators ( + , - , * , / , // , % , ** )
• Relational / Comparison Operators ( == , != , > , < , >= , <= )
• Assignment Operators ( = , -= , *= , /= , %= , //= , **= )
• Logical Operators ( not , and , or )
• Membership Operators ( in , not in )
• Identity Operators ( is , is not )
• Bitwise Operators ( & , | , ^ ) [AND, OR, XOR]
Bitwise / XOR (^) Logic Reference
XOR (^) Mathematical Truth Table Note:
1 ^ 1 -> R = 0
0 ^ 0 -> R = 0
1 ^ 0 -> R = 1
0 ^ 1 -> R = 1