-
admin
- Site Admin
- Posts: 119
- Joined: Fri May 10, 2024 2:46 pm
- Location:
Post
by admin »
#Basic if statement (IFEL01)
Code: Select all
#Basic if statement
a = 55
b = 200
if b > a:
print("b is greater than a")
#Indentation in if (code to explain error) (IFEL02)
Code: Select all
#Indentation in if (code to explain error)
a = 55
b = 300
if b > a:
print("b is greater than a") # you will get an error
#Elif (IFEL03)
Code: Select all
#Elif
a = 55
b = 55
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
#Else (IFEL04)
Code: Select all
#Else (IFEL04)
a = 400
b = 55
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
else:
print("a is greater than b")
#IF And (IFEL05)
Code: Select all
#IF And
a = 400
b = 55
c = 600
if a > b and c > a:
print("Both conditions are True")
#IF Or (IFEL06)
Code: Select all
#IF Or
a = 400
b = 55
c = 600
if a > b or a > c:
print("At least one of the conditions is True")
#IF Not (IFEL07)
Code: Select all
#IF Not
a = 55
b = 400
if not a > b:
print("a is NOT greater than b")
#Nested IF (IFEL08)
Code: Select all
#Nested IF
x = 65
if x > 15:
print("Above fifteen,")
if x > 30:
print("and also above 30!")
else:
print("but not above 20.")
-
jollyks
- Posts: 4
- Joined: Thu May 30, 2024 6:31 am
- Location: Chandigarh
- Region name: Others
Post
by jollyks »
Code: Select all
# To calculate gst using the Selection statements
amt=int(input("Enter the amount"))
print("Enter the category")
print("1 - Fresh fruits, education, services, healthcarw")
print("2 - basic mecess. packaged food, footwear , railway,etc")
print("3- Processed food")
print("4 - Goods and Services")
print("5- Luxury items")
ch=int(input("Enter the choice"))
if (ch==1):
t=0
elif (ch==2):
t=5
elif(ch==3):
t=1
elif(ch==4):
t=18
elif(ch==5):
t=28
tax=t*amt/100;
print("Tax=",tax)
-
jollyks
- Posts: 4
- Joined: Thu May 30, 2024 6:31 am
- Location: Chandigarh
- Region name: Others
Post
by jollyks »
Code: Select all
# TDS Deduction
print("Enter the nature of payment")
print("1 - Contractor Payment")
print("2 - Rent")
print("3 - TDS on Interest")
print("4- TDS on Professional Fees")
k=int(input("Enter your choice"))
if (k==1):
c=input("Enter whether individual/ HUF: i/h")
if(c=='i'):
t=1
else:
t=2
elif (k==2):
c=input("Enter whether land building/ machinery: l/m")
if(c=='l'):
t=1
else:
t=2
elif( k==3):
c=input("Enter whether PAN is provided or not: y/n")
if(c=='y'):
t=1
else:
t=2
else:
t=10
print("TDS Tax Rate=",t)