Big Data Lecture # 3
Big Data Lecture # 3
Program Example # 1
# Take two inputs from the user
input1 = input("Enter the first input: ")
input2 = input("Enter the second input: ")
# Display the inputs
print("First input:", input1)
print("Second input:", input2)
Program Example # 2
+ Addition x+y
- Subtraction x-y
* Multiplication x*y
/ Division x/y
% Modulus x%y
** Exponentiation x ** y
// Floor division x // y
Logical Operators
Or Operator
a=int(input("enter the value"))
b=int(input("enter the value"))
c=int(input("enter the value"))
if a > b or a > c:
print("a is greater than b or c")
Selection structure in Python
If statement If else
a=int(input("enter the value")) a=int(input("enter the value"))
if a >=40: if a >=40:
print("pass") print("pass")
else:
print("fail")
Nested if If Else if
a=int(input("enter the value")) a=int(input("enter the value"))
b=int(input("enter the value")) if a > 0:
c=int(input("enter the value")) print("positive")
if a > b: elseif a< 0:
if a > c: print("negative")
print("a is greater than b and c") else: print("zero")
Loops in python