Python Forum
Python if else condition using with args
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python if else condition using with args
#3
first of all, the way you have args in your code, it will expect single object - list, tuple, etc., i.e. some data structure.

If I understand you correctly, you want to loop over all elements in args:

# python3 code
for arg in args:
    if arg/10 > 40:
        print('bigger')
    else:
        print('smaller')
Reply


Messages In This Thread
RE: Python if else condition using with args - by buran - Jun-15-2017, 10:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Alteryx QS-Passing pandas dataframe column inside SQL query where condition sanky1990 0 825 Dec-04-2023, 09:48 PM
Last Post: sanky1990
Question How to compare two parameters in a function that has *args? Milan 4 1,440 Mar-26-2023, 07:43 PM
Last Post: Milan
  Python Pandas: How do I sumproduct by rows with an if condition? JaneTan 2 5,521 Jul-13-2021, 11:36 AM
Last Post: jefsummers
  *args implementation and clarification about tuple status amjass12 10 4,229 Jul-07-2021, 10:29 AM
Last Post: amjass12
  [SOLVED] Good way to handle input args? Winfried 2 2,152 May-18-2021, 07:33 PM
Last Post: Winfried
  Two Questions, *args and //= beginner721 8 3,658 Feb-01-2021, 09:11 AM
Last Post: buran
  else condition not called when if condition is false Sandz1286 10 6,093 Jun-05-2020, 05:01 PM
Last Post: ebolisa
  [HELP] Nested conditional? double condition followed by another condition. penahuse 25 8,458 Jun-01-2020, 06:00 PM
Last Post: penahuse
  Differential equations with initial condition in Python (change a working code) Euler2 1 1,898 May-29-2020, 04:06 PM
Last Post: Euler2
  does yield support variable args? Skaperen 0 1,728 Mar-03-2020, 02:44 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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