Ask coding questions

← Back to all posts
How to solve this problem
gamebrtyd (0)

I've been trying to use this function by adjusting the code multiple times but i wasn't successful so if anyone can help me would be great <3

Comments
hotnewtop
ChezCoder (1588)

Asyncio isn’t required here, use the time module provided by python:

import time

print('hi')
time.sleep(5)
print('hi after 5 seconds')
19ecal (230)

Try this

import asyncio
async def wait(time):
    await asyncio.sleep(time)
print("hi")
asyncio.run(wait(5))
print("hi2")

Or

import time
print("hi")
time.sleep(5)
print("hi2")