Python Forum
How to do this kind of IF STATEMENT?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to do this kind of IF STATEMENT?
#2
p1=1
p2=0
p3=0
p4=0
pins=[p1,p2,p3,p4]
for value in pins:
    if value == 1:
        print("true")

    else:
        print("none")
Output:
true none none none
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply


Messages In This Thread
RE: How to do this kind of IF STATEMENT? - by menator01 - Jun-16-2020, 11:55 AM
RE: How to do this kind of IF STATEMENT? - by buran - Jun-16-2020, 12:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What kind of list is this? jesse68 2 1,173 Jun-29-2022, 05:02 PM
Last Post: rob101
  splitting lines, need to add element of same kind tester_V 6 3,205 Feb-20-2021, 11:51 PM
Last Post: tester_V
  What kind of object is this? Moris526 5 2,559 Dec-27-2020, 06:41 AM
Last Post: Gribouillis
  How to write a code to get this kind of output in IDLE kavindu 5 3,602 Oct-28-2018, 07:46 PM
Last Post: wavic
  Newbie question for a kind of rolling average of list of lits zydjohn 3 3,368 Dec-16-2017, 11:41 PM
Last Post: ezdev
  Compiler fault or some kind of weird referencing bug? Joseph_f2 11 9,245 May-09-2017, 08:50 PM
Last Post: volcano63

Forum Jump:

User Panel Messages

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