Answers for "if and python"

2

if in python

# if statment 
#'if' gives condition in statement to make program more efficient.
a=10
b=5
if a%b==0:
    print('true')

output:
true
Posted by: Guest on November-26-2021
6

python if and

if foo == 'abc' and bar == 'bac' or zoo == '123':
  # do something
Posted by: Guest on December-22-2020
3

if syntax in python

variable_name = input("y/n? >> ")
if variable_name == "y":
	print("That's good! :) ")
# note the double equal signs. only a single equal sign will receive a Syntax error blah blah blah message.
elif variable_name == "n":
    print("That's bad! :( ")
else:
    print("You blow up for not following my instructions. Detention forever and get lost!")
Posted by: Guest on January-21-2021
2

python if condition

if my_condition:
  # Do some stuff
  print("Hello You!")
else:
  # Do some stuff
  print("Hello World!")
Posted by: Guest on January-16-2021
2

if else python

# IF ELSE ELIF
age=int(input("Enter your age:"))
if age<=18:
  print("sorry your are not eligible for vote")
elif age>=18:
  print("u are eligible for vote")
else:
  print("in some how the previou's condition fails else part will run")
Posted by: Guest on January-01-2021
0

or in if statement python

weather == "Good!" or weather == "Great!": 

# Or the following  

weather in ("Good!", "Great!"):
Posted by: Guest on April-03-2021

Python Answers by Framework

Browse Popular Code Answers by Language