Python Forum
Super flexibility in python, examples
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Super flexibility in python, examples
#1
finds the maximum both in the text and in numbers from two related functions, it is really beautiful.
in1=str(input("1. insert text: "))
in2=str(input("2. insert text: "))
in3=str(input("3. insert text: "))
def max1(a,b):
    if a>b:
        return a
    else:
        return b    
def max2(a,b,c):
    return max1(a,max1(b,c))
c = max1(in1,in2)
d = max2(in1,in2,in3)
print(f"max between 1 and 2= {c}")
print(f"max between 2 and 3= {d}")
Reply


Messages In This Thread
Super flexibility in python, examples - by Kakha - Jan-06-2021, 07:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems with super() Hoespilaar 3 531 Jun-11-2024, 02:15 AM
Last Post: kanetracy
  super() in class akbarza 1 710 Dec-19-2023, 12:55 PM
Last Post: menator01
  Understanding Python super() for classes OmegaRed94 1 1,958 Jun-09-2021, 09:02 AM
Last Post: buran
  Examples of Customer requirements ComputerAstronaut 1 1,942 Dec-08-2020, 03:22 AM
Last Post: Larz60+
  Super Urgent, work related. Gimp Python tsurubaso 5 3,152 Oct-19-2020, 08:18 AM
Last Post: tsurubaso
  print() examples leodavinci1990 3 2,083 Aug-21-2020, 03:34 PM
Last Post: snippsat
  superclass and super() grkiran2011 1 1,845 Jun-20-2020, 04:37 AM
Last Post: deanhystad
  MRO About super() catlessness 1 2,152 Jan-12-2020, 07:54 AM
Last Post: Gribouillis
  Super with Sublime Text - TypeError: super() takes at least 1 argument (0 given) Shafla 6 7,724 May-04-2019, 08:30 PM
Last Post: Shafla
  mpi4py examples/tutorials MuntyScruntfundle 1 2,792 Dec-01-2018, 10:22 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