Python Forum
two conditionals with intermediate code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
two conditionals with intermediate code
#1
i encounter this case a lot. in an elif sequence of code i need to perform 2 tests at one place. that often means an and or or between 2 tests. sometimes the 2nd test needs to run some code to produce what is to be tested. i usually have to put that code before the first if. sometimes i can do the test in a function. in C i could store the value to be tested if it was part of the 1st test. i wonder if anyone has worked out a general way of this that is Pythonic.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
two conditionals with intermediate code - by Skaperen - Jul-11-2020, 10:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Doubt about conditionals in Python. Carmazum 6 1,669 Apr-01-2023, 12:01 AM
Last Post: Carmazum
  conditionals based on data frame mbrown009 1 926 Aug-12-2022, 08:18 AM
Last Post: Larz60+
  Efficiency with regard to nested conditionals or and statements Mark17 13 3,293 May-06-2022, 05:16 PM
Last Post: Mark17
  Nested conditionals vs conditionals connected by operators dboxall123 8 3,134 Feb-18-2022, 09:34 PM
Last Post: dboxall123
  Nested Conditionals shen123 3 2,673 Jul-28-2021, 08:24 AM
Last Post: Yoriz
  Invalid syntax using conditionals if - else jperezqu 1 2,366 Jan-13-2021, 07:32 PM
Last Post: bowlofred
  conditionals with boolean logic?? ridgerunnersjw 3 2,028 Sep-26-2020, 02:13 PM
Last Post: deanhystad
  Conditionals, while loops, continue, break (PyBite 102) Drone4four 2 3,032 Jun-04-2020, 12:08 PM
Last Post: Drone4four
  Nested Conditionals HELP absolum 4 2,831 Jul-17-2019, 06:40 PM
Last Post: absolum
  intermediate book recommendation please? jameson984 1 2,064 Jul-15-2019, 03:21 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

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