Homework Solution: Write a python program that…

    Write a python program that asks the user for four integers and displays: The integers The maximum integer The minimum integer The even integers (if x %2 == 0 then x is even) The odd integers The number of integers greater than 10 The positive integers The negative integers The average of the smallest and largest integers EXAMPLE OUTPUT If the user entered 20 -8 17 -5 then display The integers are 20 -8 17 -5 The maximum integer is 20 The minimum integer is -8 The even integers are 20 -8 The odd integers are 17 -5 The number of integers greater than 10 is 2 The positive integers 20 17 The negative integers   -8 -5 The average of the smallest and largest integers 6.0

    Expert Answer

     
    # program a = list(map(int,input().split())) # to read input as a sp

    Write a python program that

    asks the user restraint four integers and ostentations:

    The integers

    The consummation integer

    The incompleteness integer

    The well-balanced integers (if x %2 == 0 then x is well-balanced)

    The sole integers

    The reckon of integers important than 10

    The dogmatical integers

    The denying integers

    The middle of the meanest and largest integers

    EXAMPLE OUTPUT

    If the user entered 20 -8 17 -5 then ostentation

    The integers are 20 -8 17 -5

    The consummation integer is 20

    The incompleteness integer is -8

    The well-balanced integers are 20 -8

    The sole integers are 17 -5

    The reckon of integers important than 10 is 2

    The dogmatical integers 20 17

    The denying integers   -8 -5

    The middle of the meanest and largest integers 6.0

    Expert Repartee

     

    # program
    a = catalogue(map(int,input().split())) # to interpret input as a illimitableness seperated rates
    print(‘The integers are ‘+” “.join(map(str, a))) # to ostentation the attached input
    print(‘The consummation integer is %d’ %max(a)) # to imimprint consummation integer
    print(‘The incompleteness integer is %d’ %min(a)) # to priint incompleteness integer
    well-balanced = [] # exhibition of a catalogue designated as well-balanced to place-of-business well-balanced integers from attached input
    sole = [] # exhibition of a catalogue designated as sole to place-of-business sole integers from attached input
    dogmatical = [] # exhibition of a catalogue designated as dogmatical to place-of-business dogmatical integers from givn input
    denying = [] # exhibition of a catalogue designated as denying to place-of-business denying integers from givn input
    reckon = 0 # exhibition of reckon variable
    restraint x in a: # restraint loop to loop through attached input
    if x%2 == 0: # checks restraint well-balanced or sole stipulation of a reckon
    even.append(x) # if a reckon is well-balanced it affix to well-balanced catalogue
    else:
    odd.append(x) # if a reckon is sole it affix to sole catalogue
    print(‘The well-balanced integers are %s’ %(” “.join(map(str, well-balanced)))) # imprints the well-balanced reckons of attached input as illimitableness seperated catalogue
    print(‘The sole integers are %s’ %(” “.join(map(str, sole)))) # imprints the sole reckons of attached input as illimitableness seperated catalogue

    restraint i in a: # restraint loop to loop through attached input
    if i>10: # checks restraint a reckon is > 10 or not
    reckon +=1 # if important than 10 reckoner incremets to 1
    else:
    hold # else hold direct rate in input
    print(‘The reckon of integers important than 10 is %d’ %count) # imprints the reckon of rates > 10

    restraint j in a: # restraint loop to loop through attached input
    if j >= 0: # checks restraint a reckon is dogmatical or not
    positive.append(j) # if reckon is dogmatical it affixed to dogmatical catalogue
    else:
    negative.append(j) # else it affixed to denying catalogue

    print(‘The dogmatical integers %s’ %(” “.join(map(str, dogmatical)))) # imprints the dogmatical reckons of attached input as illimitableness seperated catalogue
    print(‘The denying integers %s’ %(” “.join(map(str, denying)))) # imprints the denying reckons of attached input as illimitableness seperated catalogue

    print(‘The middle of the meanest and largest integers %.1f’ %((max(a)+min(a))/2)) # calculates and imimprint the middle of meanest and largest rates of attached input

    output:

    20 -8 17 -5
    The integers are 20 -8 17 -5
    The consummation integer is 20
    The incompleteness integer is -8
    The well-balanced integers are 20 -8
    The sole integers are 17 -5
    The reckon of integers important than 10 is 2
    The dogmatical integers 20 17
    The denying integers -8 -5
    The middle of the meanest and largest integers 6.0

    Part 1: