Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
if else return
#1
I am new to Python. I am trying to have the following function change the values of certain lines depending on if the lines are populated or not. Please assist if you can. Thanks in advance.



def checkconsent (CF):
	original_consent = CF
	var = CF[0:2]
	var1 = "RY"
	if CF == "RY" or "RN" or "NY" or "NN":
		return var
	else:
	    return var1
CONSENT = aps.checkconsent(line[1491:1493])
CONSENT1 = aps.checkconsent(line[1493:1495])
CONSENT2 = aps.checkconsent(line[1495:1497])
CONSENT3 = aps.checkconsent(line[1497:1499])
CONSENT4 = aps.checkconsent(line[1499:1501])
CONSENT5 = aps.checkconsent(line[1501:1503])
Reply


Messages In This Thread
if else return - by gujugolf - Dec-30-2017, 05:05 AM
RE: if else return - by Mekire - Dec-30-2017, 05:31 AM
RE: if else return - by gujugolf - Dec-30-2017, 01:07 PM
RE: if else return - by squenson - Dec-30-2017, 01:29 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020