Answers for "python if statement"

42

python if statement

usrinput = input(">> ")
if usrinput == "Hello":
  print("Hi")
elif usrinput == "Bye":
  print("Bye")
else:
  print("Okay...?")
Posted by: Guest on May-13-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
5

if statement in python

#Conditionals statements in python
#'=' conditionals statements
a = 123
b = 123

if(a==b):
  print('True')
  
#<, > conditionals statements

a = 2
b = 45

if(a<b):
  print('A is smaller than B')
Posted by: Guest on October-04-2020
8

if statement in python

answer = input(":")
if answer == "lol":
  print("haha")
else:
  print("not haha")
  exit()

please note that the exit() command is optional and is not necessary.
Posted by: Guest on June-17-2020
1

pythone if

a = 200
b = 33
c = 500

if a > b and c > a:
	print("Both conditions are True")
Posted by: Guest on May-06-2021
9

python if statement

if (condition1):
  print('condition1 is True')
elif (condition2):
  print('condition2 is True')
else:
  print('None of the conditions are True')
Posted by: Guest on March-16-2020

Python Answers by Framework

Browse Popular Code Answers by Language