Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Functions, skip an arugment
#1
Hi everyone,

How can we skip functions argument in Python

For example I have this function

def F_Three(a,b=2,c=10):
    print((a/b)*c)

F_Three(10,,2)
When I call my function I skip the middle one but this give me an error.
Is there any way to skip an argument in python ?

Thanks.
[Image: NfRQr9R.jpg]
Reply
#2
yes, pass arguments after it as keyword arguments
F_Three(10,c=2)
I personally prefer to pass all of them as keyword, as it makes the call more clear
F_Three(a=10,c=2)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Thank you @buran
[Image: NfRQr9R.jpg]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  need to skip password prompt, continue... tester_V 2 1,463 Oct-19-2021, 05:49 PM
Last Post: tester_V
  Delimiters - How to skip some html tags from being translate Melcu54 0 1,647 May-26-2021, 06:21 AM
Last Post: Melcu54
  How to skip to a different line while importing a different script kat_gamer 2 2,235 Feb-03-2021, 04:10 AM
Last Post: deanhystad
  How to skip a folder directory in a loop mfkzolo 2 12,534 Nov-18-2020, 07:56 AM
Last Post: mfkzolo
  How to skip LinkedIn signup link using python script? Mangesh121 0 1,792 Aug-26-2020, 01:22 PM
Last Post: Mangesh121
  How to calculate column mean and row skip non numeric and na Mekala 5 4,930 May-06-2020, 10:52 AM
Last Post: anbu23
  Skip a line doug2019 4 3,153 Oct-09-2019, 06:56 PM
Last Post: ichabod801
  Skip header python_bg1 1 1,974 Jul-25-2019, 01:34 AM
Last Post: ichabod801
  Python: why skip the 'else' if password is wrong Max_988 1 1,957 Jun-20-2019, 12:19 AM
Last Post: woooee
  Function to skip meta data in a .csv file using Python ajgardev 1 2,510 Jul-22-2018, 12:53 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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