Friday, 10 November 2023

Python Coding challenge - Day 65 | What is the output of the following Python code?

 


Code - 

def add(a, b):

    return a + 5 , b + 5

print(add(10,11))

Solution - 

The add function takes two parameters, a and b, and returns a tuple where the first element is the sum of a + 5 and the second element is b + 5.

When you call add(10, 11), it will return a tuple where the first element is 10 + 5 (which is 15) and the second element is 11 + 5 (which is 16). Therefore, the output of print(add(10, 11)) will be: (15, 16)



Related Posts:

  • Iterators in Python Iterator in python is any python type that can be used with a ‘for in loop’. Python lists, tuples, dicts and sets are all examples of inbuilt itera… Read More
  • Accessing Counters in Python Once initialized, counters are accessed just like dictionaries. Also, it does not raise the Key Value error (if key is not present) instead the val… Read More
  • Function Decorator in Python Following are important facts about functions in Python that are useful to understand decorator functions. 1.In Python, we can define a function … Read More
  • Counter in Python What is counter? Counter is a container included in the collections module. What is container? Containers are objects that hold objects. They … Read More
  • Empty Function in Python In C/C++ and Java, we can write empty function as following // An empty function in C/C++/Java void fun() { } In Python, if we write something l… Read More

0 Comments:

Post a Comment

Popular Posts

Categories

100 Python Programs for Beginner (108) AI (41) Android (24) AngularJS (1) Api (2) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (200) C (77) C# (12) C++ (83) Course (67) Coursera (252) Cybersecurity (25) Data Analysis (3) Data Analytics (3) data management (11) Data Science (149) Data Strucures (8) Deep Learning (21) Django (16) Downloads (3) edx (2) Engineering (14) Euron (29) Events (6) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Generative AI (11) Google (36) Hadoop (3) HTML Quiz (1) HTML&CSS (47) IBM (30) IoT (1) IS (25) Java (93) Java quiz (1) Leet Code (4) Machine Learning (86) Meta (22) MICHIGAN (5) microsoft (4) Nvidia (4) Pandas (4) PHP (20) Projects (29) pyth (1) Python (1066) Python Coding Challenge (465) Python Quiz (136) Python Tips (5) Questions (2) R (70) React (6) Scripting (3) security (3) Selenium Webdriver (4) Software (17) SQL (42) UX Research (1) web application (8) Web development (4) web scraping (2)

Followers

Python Coding for Kids ( Free Demo for Everyone)