printing

how do I return a list containing print statements?

how do I return a list containing print statements? Question: So i am working on this function that takes a list as a parameter containing positive int, negative int, and the number 0 (zero). I have written the function using a while function with nested if statements to determine the value of each integer. Here …

Total answers: 3

Problem with printing and sleeping in for loop with end key word argument

Problem with printing and sleeping in for loop with end key word argument Question: When I write the following code into python file/console: import time, os string = "what am I saying right now?" for x in string: print(x) time.sleep(.1) Output: w h a t a m I s a y i n g r …

Total answers: 1

Searching for a specific value within a list of dictionaries

Searching for a specific value within a list of dictionaries Question: I need to be able to print all instances of a name within the list of dictionaries. I can’t seem to be able to print them in the desired format. It also doesn’t work when it’s in lowercase and the name is in uppercase. …

Total answers: 3

How to print only one item from a dictionary with a changeable variable

How to print only one item from a dictionary with a changeable variable Question: I am trying to print only one key and value from my dictionary at a time and have it print based on the player current room position. Every solution I tried so far, either prints all of the items, all the …

Total answers: 1

how to filter out data from a print out message

How to filter out data from a print out message Question: I have this one problem, where I print out a message response from a website(JSON response), and the response I get is this. Here is my model with fake data: {"token": "MTAxOTAwNjM4NjEyMzg0OTkwMQ.8hkyLV.n0ir2UA4qFE5pXen9YnPtFzgn4xP8tHmVmmkrl", "user_settings": {"locale": "en-US", "theme": "dark"}, "user_id": "101900638614857883"} And, if I only want …

Total answers: 2

How to Print Python Lists as String

How to Print Python Lists as String Question: I would like to know how to print python lists as String instead of list. When I add the three lists I get the following result [‘a’, ‘b’, ‘c’, ‘d’, ‘0’, ‘1’, ‘!’, ‘#’] I want this output: abcd01!# import random letters = [‘a’, ‘b’, ‘c’, ‘d’, …

Total answers: 1

How to print a list with no leading commas with sep=", " into a string?

How to print a list with no leading commas with sep=", " into a string? Question: The title maybe a bit confusing so here is the gist of it: I have this list: mylist = [0, 4, 8, 12] and I want to print only the elements after some string. So I did this: print("The …

Total answers: 2

What is the difference between calling a function and printing a function?

What is the difference between calling a function and printing a function? Question: In this simple project I tried to create a simple rock, paper, sccissors program. import random def play(): user = input(f"’r’ for rock, ‘p’ paper, ‘s’ for scissors: ") computer = random.choice([‘r’, ‘p’, ‘s’]) if user == computer: return ‘It’s a tie’ …

Total answers: 2

Print nested list in a particular way

Print nested list in a particular way Question: I have this list: top_list = [[‘Recent news’, ’52’, ‘15.1’], [‘Godmorning’, ‘5’, ‘1.5’], [‘Sports news’, ’47’, ‘13.7’], [‘Report with weather’, ’34’, ‘9.9’], [‘The angel and the lawless’, ’33’, ‘9.6’], [‘Thundercats’, ‘3’, ‘0.9’], ["Mother’s legacy", ‘3’, ‘0.9’], [‘UR: Summer evenings with Europe of the Times’, ‘3’, ‘0.9’], [‘Tip’, …

Total answers: 1