import redis r = redis.StrictRedis(charset="utf-8", decode_responses=True) r.set("kim","holidays") r.set("kanye","costumes") r.set("kylie","well") r.set("kourtney","love") r.set("khloe","covid") r.set("kendall","well") r.hset("holidays","Valentine's","love") r.hset("holidays","Thanksgiving","gratitude") r.hset("holidays","Halloween","fear") r.hset("costumes","Dracula","cape") r.hset("costumes","Superman","cape") r.hset("costumes","Dracula","teeth") r.lpush("cape","well") r.lpush("cape","then") r.rpush("teeth","self") r.rpush("teeth","harry") r.lpush("teeth","potter") r.set("self","others") r.lpush(r.hget("costumes","Dracula"),r.get("kylie")) r.lpush(r.hget("costumes","Dracula"),"wish") r.hset(r.get("kanye"),"Batman","cape") r.zadd(r.get("kourtney"),{"mind":50,"brain":75}) r.zadd(r.get("kylie"),{"soul":55,"body":85,"mind":75}) r.zadd(r.get("kourtney"),{"body":15}) r.zincrby(r.get("kendall"),25,"soul") r.lpush(r.hget("costumes","Dracula"),"luck") r.lpush(r.hget("costumes","Superman"),"skill") r.rpush(r.hget("costumes","Batman"),"guts") r.lpush(r.hget("costumes","Superman"),"hers") r.set("guts","his") r.rpush(r.hget("costumes","Batman"),"theirs") r.lpush(r.hget("costumes","Dracula"),"hers") r.hdel(r.get("kanye"),"Batman") r.set("Batman",r.lindex("cape",r.hlen("costumes")-1)) r.set("khloe",r.lindex("cape",r.hlen("costumes")-2)) print(r.hget('holidays','Halloween'), end=" ") print(r.getrange(r.lindex('cape',4),1,2), end=" ") print(r.getrange(r.lindex(r.hget(r.get("kanye"),"Dracula"),5),1,3), end=" ") print(r.zrange(r.get("kendall"),0,0)[0], end=" ") print(r.getrange("Batman",1,4) + r.getrange("khloe",1,2))