Exercise 1 solution : Python tutorial 74

Guys please help this channel to reach 20,000 subscribers. I’ll keep uploading quality content for you.

Python is easy programming language to learn and anyone can learn it, and these tutorials are 100% free in hindi.

You can share this playlist with your brother, sisters and friends. This will surely add some values to their life.

Complete Playlist link – https://www.youtube.com/playlist?list=PLwgFb6VsUj_lQTpQKDtLXKXElQychT_2j

If you follow this complete playlist of python tutorial surely you will learn everything about python programming language.

This is solution of exercise 1

Source Code Link – https://www.dropbox.com/s/nch1ra9kfxv5phr/ch4ex1sol.py?dl=0

source by Harshit vashisth

python tutorial

Mourad ELGORMA

Mourad ELGORMA

Fondateur de summarynetworks, passionné des nouvelles technologies et des métiers de Réseautique , Master en réseaux et système de télécommunications. ,j’ai affaire à Pascal, Delphi, Java, MATLAB, php …Connaissance du protocole TCP / IP, des applications Ethernet, des WLAN …Planification, installation et dépannage de problèmes de réseau informatique……Installez, configurez et dépannez les périphériques Cisco IOS. Surveillez les performances du réseau et isolez les défaillances du réseau. VLANs, protocoles de routage (RIPv2, EIGRP, OSPF.)…..Manipuler des systèmes embarqués (matériel et logiciel ex: Beaglebone Black)…Linux (Ubuntu, kali, serveur Mandriva Fedora, …). Microsoft (Windows, Windows Server 2003). ……Paquet tracer, GNS3, VMware Workstation, Virtual Box, Filezilla (client / serveur), EasyPhp, serveur Wamp,Le système de gestion WORDPRESS………Installation des caméras de surveillance ( technologie hikvision DVR………..). ,

50 réflexions sur “Exercise 1 solution : Python tutorial 74

  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    I have make a different version, pls ck if it is correct:
    def max_value(x,y):

    return max(x,y)

    num1 = int(input("first num: "))

    num2 = int(input("second num: "))

    print(max_value(num1,num2))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    Sir I have an question.
    Apne yaha jab function call kraya tab user se input lene k liye full lines kyu likhi

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    Sir hum call k time pr bs ye likhenge na print (greater (10,20))
    Hum user se input likhna kyu show kr rhe h

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    Done !!!!!!

    def checkMax(a,b):

    if a>b:

    return a

    else:

    return b

    n1,n2=input("Enter the n1 ,n2 :").split(",")

    n1=int(n1)

    n2=int(n2)

    print(f"Greatest Number is :{checkMax(n1,n2)}")

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def greater(a,b);

    if a>b:

    return A greater than B

    else:

    return B is greater than A

    num1 =input int(enter fisrt num 🙂

    num2 =input int(enter second num 🙂

    bigger (f"{bigger} is greater ")
    ERROR KAHA HAI KOI BATAYEGA MJHE def may error arha hai is vedio k koi bhi function use kar raha hu jab bhi

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def greater (a,b);

    if a > b:

    return A

    else:

    return B

    num1 = int(input ("enter fisrt num" ))

    num2 = int(input ("enter second num" ))

    biggar = greater(num1,num2)

    print (f"{biggar} is greater ")
    def keyword q use nai kar pa raha may??? hel me plzzzzz

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    # def bigger(n1,n2):

    # if n1 > n2:

    # return n1

    # return n2

    # num1 = int(input("Enter number1 number : "))

    # num2 = int(input("Enter number2 number : "))

    # greater = bigger(num1,num2)

    # print(f"{greater} is greater")

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def greater_num(num1 , num2):
    if num1 != num2:
    if num1 > num2:
    return(num1)
    return(num2)
    return("Equal")

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def Compair(a,b):

    if a > b:

    return "a is grter then b"

    elif a < b :

    return "a is smaler then b "

    else:

    return "a is eqal to b"

    m, n =input("Enter the two number ").split()

    print(Compair(m,n))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    If we take two input in same line,is it possible to covert them both to integer in the same line while taking input like num1,num2 = int(input( ENter number)).split(" ")

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    v1=int(input("enter value 1: "))

    v2=int(input("enter value 2: "))

    def math(v1,v2):

    if v1 < v2:

    return "v2 is grather than v1"

    elif v2 < v1:

    return "v1 is grather than v2"

    elif v1 == v2:

    return "both are equal"

    print(math(v1,v2))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def greater_num(a,b):

    if a > b:

    return f'greater number is {a}'

    elif b > a:

    return f'greater number is {b}'

    else:

    return "both are equal"

    num1 = int(input('enter first number : '))

    num2 = int(input('enter second number : '))

    print(greater_num(num1,num2))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def min_max(num1,num2):
    if int(num1)>int(num2):
    return num1
    return num2

    var1=input("Please Enter Number 1 : n")
    var2=input("please Enter Number 2 : n")
    var3=min_max(var1,var2)
    print(f"This Number {var3} is Bigger Than The Other")

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def greater_no(a,b):

    if a>b:

    return (f"this is greater no:{a}")

    else:

    return (f"this is grater no:{b}")

    x=int(input("enter your 1st no:"))

    y=int(input("enter your 2nd no:"))

    print(greater_no(x,y))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    num1, num2 = input("please enter 2 numbers.").split()
    def chck_Bigger_Number(a,b):
    if a>b:
    return f"{a} is grater"
    else:
    return f"{b} is grater"
    print(chck_Bigger_Number(num1,num2))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    num1 = int(input('Enter First Number : '))

    num2 = int(input('Enter Second Number : '))

    def result(a,b):

    if a > b:

    return "First Number is Greater"

    elif a < b:

    return 'Second Number is Greater'

    elif a == b:

    return 'Both are Equal'

    print(result(num1,num2))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    a = int(input("Enter a number: "))
    b = int(input("Enter a number: "))
    def greater(a,b):
        if a > b:
            return" a is Greater"
        elif a==b:
            print("Both values are Equal")

        else:
            return" b is Greater"
    print(f"value '{greater(a,b)}'")

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def greater(a,b):

    if a > b:

    return a
    else:

    return b
    num1 = int(input("enter first number"))

    num2 = int(input("enter second number"))

    bigger = greater(num1,num2)

    print(f"{bigger} is greater")

    sir im trying to run above command but unable to see result(output)
    sir you or someone else can explain me, which mistake am i doing?

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def greater(a,b):
    if a>b:
    return "A is greater than B"
    return "B is greater than A"
    a=int(input("Enter The Value of A: "))
    b=int(input("Enter The Value of B: "))
    print(greater(a,b))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    # def greater_number(x,y):

    # if x==y:

    # print("Both are equal's")

    # elif x>y:

    # print (f"{x} is greater than {y}")

    # else:

    # print (f"{y} is greater than {x}")

    # a = int (input("Enter first value: "))

    # b = int (input ("Enter Second value: "))

    # greater_number(a,b)

    # ************************ OR **************************************

    def fun(x,y):

    if x>y:

    return x

    else:

    return y

    a = int (input("Enter first value: "))

    b = int (input ("Enter Second value: "))

    print (f"Greater value is: {fun(a,b)}")

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def m(a,b,c):
    if a>b and a>c:
    return a
    elif b>c:
    return b
    else:
    return c
    print(m(60,40,80))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    I did it in 2 different ways
    # making function of user input
    def sum(num,num1):
    if num > num1: # comparing and finding which is large
    return f"{num} is greater"
    else:
    return f"{num1} is greater"
    print(sum(int(input("enter first number: ")),int(input("entet second number: "))))
    # making in less line of code
    def func(num3,num4):
    return max(num3,num4) # returning max by max dunction
    print(func(int(input("enter a number")),int(input("enter anpther number: "))))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    k = int(input("num1: "))
    z = int(input("num2: "))

    def greater_num(k,z):
    if k<z:
    return z
    elif k>z:
    return k
    elif k==z or z==k:
    return k and z

    r = greater_num(k,z)
    print(r)

    Sir plz tell how is it

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    U don't have need to change the input in integer, see my code..
    def greater_num(a,b):
    if a > b:
    return a
    return b

    num1, num2 = input("Enter two numbers with comma seperated : ").split(",")
    print(greater_num(num1,num2))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    Sir when I used comma separated input and take it as an integer it shows an error that argument must be in string but u took both input separated as an integer

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def num(a,b):

    if a > b:

    return (f"{a} is greater")

    return (f"{b} is greater")

    num1 = int(input("Enter first number: "))

    num2 = int(input("Enter second number: "))

    greater = num(num1,num2)

    print(greater)

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    check this,
    def great(a,b):
    return f'{a}' if a > b else f'{b}'
    a = int(input('enter 1st num: '))
    b = int(input('enter 2nd name: '))
    print(great(a,b))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    x, y = input("Enter two numbers separated by comma: ").split(",")

    def is_greater(x,y):

    if(x>y):

    return x

    return y

    print(is_greater(x,y))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    Sir when I used comma separated input and take it as an integer it shows an error that argument must be in string but u took both input separated as an integer

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def greatest_no(num1,num2):

    if num1 > num2:

    return num1

    return num2

    num1 = int(input("Enter first number : "))

    num2 = int(input("Enter second number : "))

    print(greatest_no(num1,num2))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def Greatest_Number(a,b):

    if a>b:

    return a

    else:

    return b

    a = int(input("Enter First Number: "))

    b = int(input("Enter Second Number: "))

    v = Greatest_Number(a,b)

    print("Greatest Number is", v)

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def num(a,b):

    if a>b:

    return a

    return b

    a = int(input("Enter 1st number"))

    b = int(input("Enter 2nd number"))

    print(num(a,b))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def greater(a,b):

    if a>b:

    return a

    return b

    num1, num2 = map(int,input("Enter two numbers separated by comma: ").split())

    print(greater(num1, num2))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    Sir I made it in a different way:

    x= int(input("enter first number :))"
    y=int(input("enter second number:))"
    def greater_number(x,y)
    If x >= y:
    return (f"{x} is greater than {y} "
    else:
    y >= x
    return (f"{y} is greater than {x} "

    print(greater_number(x,y))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def greater(a,b):

    if int(a)>int(b):

    return(a)

    else:

    return(b)

    m=int(input("enter 1st no.:"))

    n=int(input("enter 2nd no.:"))

    print (greater(m,n))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def greater(a,b):

    if a>b:

    return a

    return b

    num1 = int(input("enter fn "))

    num2 = int(input("enter ln "))

    print(greater(num1,num2))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    but if user gave two same number???

    def greater(num1, num2):

    if num1 < num2:

    return num2

    elif num1 > num2:

    return num1

    elif num1 == num2:

    return "Both input is equal"

    a = int(input("Enter the number: "))

    b = int(input("Now the another one: "))

    print(greater(a,b))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    #what if both number are equal… here is my code

    a = int(input('enter 1st number'))

    b = int(input('enter 2nd number'))

    def big_num(a,b):

    if a>b:

    return (a ,"is greater")

    elif a<b:

    return (b, "is greader")

    return ("both are same")

    print(big_num(a,b))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    my Method

    def greater(a,b):

    return a>b

    num1=int(input("enter a number"))

    num2=int(input("enter a number"))

    if greater(num1,num2) == True:

    print(num1)

    else:

    print(num2)

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def grt_small(a,b):

    if int(a)-int(b) > 0:

    return("First number is greate than second")

    elif int(b)-int(a) > 0:

    return("Second number is greater than first")

    else:

    return("both the numbers are equql")

    num1 = input("Please enter 1st number ")

    num_1 = int(num1)

    num2 = input("Please enter 2nd number ")

    num_2 = int(num2)

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    def num(a,b):

    if a>b :

    return f"{a} is greater number"

    return f"{b} is greater number"

    a = int(input("Enter 1st number: "))

    b = int(input("Enter 2nd number: "))

    print(num(a,b))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    #I done this
    def greater_smaller(x,y):
    if x>y:
    return str(x) +" greater"
    else:
    return str(y) + " greater"

    while True:
    x=int(input("Enter First Number : "))
    y= int(input("Enter Second Number : "))
    print(greater_smaller(x,y))

    Répondre
  • Avatar
    mai 3, 2021 à 9:57
    Permalien

    num_1 = int(input("Write number 1:"))
    num_2 = int(input("Write number 2:"))
    def is_greatest(a, b):
        if a > b:
            return f"{a} is greater than {b}"
        return f"{a} is less than {b}"
    print(is_greatest(num_1,num_2))

    Répondre

Laisser un commentaire