Mode Gelap

Recent in Fashion

Best Seller Books

Noise Levels

  • Problem Description

    The following table lists the sound level in decibels for several common noises.Noise Decibel level (dB),

    Jackhammer 130
    Gas lawnmower 106
    Alarm clock 70
    Quiet room 40 

    Write a program that reads a sound level in decibels from the user. 

    If the user enters a decibel level that matches one of the noises in the table then your program should display a message containing only that noise. 

    If the user enters a number of decibels between the noises listed then your program should display a message indicating which noises the level is between. 

    Ensure that your program also generates reasonable output for a value smaller than the quietest noise in the table, and for a value larger than the loudest noise in the table.

    Note:
    Use only if and elif
  • CODING ARENA
  • a=int(input())
    if(a>=130):
        print("Jackhammer")
    elif(a>=106 and a<130):
        print("Gas lawnmower")
    elif(a>=70 and a<106):
        print("Alarm clock")
    elif(a>=40 and a<70):
        print("Quiet room")
    else:
        print("******")

  • Test Case 1

    Input (stdin)
    130

    Expected Output
    Jackhammer
  • Test Case 2

    Input (stdin)
    106

    Expected Output
    Gas lawnmower

Subscribe Our Newsletter

avatar
"By speaking behind my back, it means that you respect my existence enough not to act in front of my face."

Related Posts

0 Comment

Post a Comment

Article Top Ads

Parallax Ads

Article Center Ads

Article Bottom Ads