How can i improve my VU Meter

Dear Sirs,

Is it not strange that I have to write twice in my code:

import grove pi
from grovepi import *

and

import time
from time import sleep

I connected a microphone to A0 on my Grovepi and a ledbar to D5.
Thereafter I wrote te next code: (see below)

What do you think about it?
can you give me your profesional opinion and give me some points to improve the code?

Yours sincerely,
Marc stevens.

import grovepi
from grovepi import *
import time
from time import sleep

ledbar=5

while True:
volume=analogRead(0)
vol=volume/10
if vol>100:
grovepi.ledBar_setLevel(ledbar, 10)
sleep(.1)

if vol>90:
   grovepi.ledBar_setLevel(ledbar, 9)
   sleep(.1)
   
if vol>80:
    grovepi.ledBar_setLevel(ledbar, 8)
    sleep(.1)
    
if vol>70:
   grovepi.ledBar_setLevel(ledbar, 7)
   sleep(.1)
   
if vol>60:
    grovepi.ledBar_setLevel(ledbar, 6)
    sleep(.01)
    
if vol>50:
    grovepi.ledBar_setLevel(ledbar, 5)
    sleep(.1)
    
if vol>40:
    grovepi.ledBar_setLevel(ledbar, 4)
    sleep(.1)
    
if vol>30:
    grovepi.ledBar_setLevel(ledbar, 3)
    sleep(.1)
   
if vol>20:
    grovepi.ledBar_setLevel(ledbar, 2)
    sleep(.1)
   
elif vol>10:
    grovepi.ledBar_setLevel(ledbar, 1)
    sleep(.1)
   
else:
    grovepi.ledBar_setLevel(ledbar, 0)
    sleep(.1)

You have not understood Python import and namespaces.

import time

means the time namespace is known, so to access sleep you need to write:

time.sleep(0.1)

When you use

from time import sleep

you have told Python you want the sleep method directly available in the namespace.

You do not need the import time if the only method you want in the namespace is sleep().

In small programs with few imports, and from xyz import abc it is easy to remember that abc () comes from the xzy module, but in large programs with many imports and multiple methods from each module, using the explicit namespace import xyz and xyz.abc() does not hide the containing module.

Perhaps you could simplify using something like:

leds = int(vol/100.0)   # note the use of a decimal and explicit use of int() method - 
                        # leds = vol/100  might also work, doing the int() as part of the division
grovepi.ledBar_setLevel(ledbar, leds)

but may need to handle the boundary cases special.