python-2.7

TypeError: economico() missing 2 required positional arguments: 'carro' and 'consumo'

TypeError: economico() missing 2 required positional arguments: 'carro' and 'consumo' Question: I have an assignment to turn in for the University. I already got the correct result in VS Code with the code below (the idea is to show the car with the lowest consumption): def entrada_carro(): carro = [] for i in range(4): carro.append(input("Digite …

Total answers: 1

I wanted to print this tuple in a single line

I wanted to print this tuple in a single line Question: I was making a small program to exemplify the wordle game in python but the code below generates an output in tuple format (one element per line). Like this: T _ E T E the code: def check_palpite(): palavra_secreta = "Sorte" tentativas = 6 …

Total answers: 1

swapping position of two specific numbers in a text file python?

swapping position of two specific numbers in a text file python? Question: I want to swap two numbers position on each line of the text file after i replace equal symbol with this ‘|’ and save it, but I’m having trouble to do that! For instance 123456789=123456789 i wanted it to look like this: 123453489=126756789 …

Total answers: 1

How to create folder and subfolders if they don't exist with remote send

How to create folder and subfolders if they don't exist with remote send Question: I need to send the images downloaded from one server to another. However, I need to save the images in folder with "year" , "month . Here’s an example: ftp = ftplib.FTP(‘ftp-server’,’userftp’,’*********’) file = open(‘download-torrent-filme.webp’,’rb’) ftp.storbinary(‘STOR year/month/download-torrent-filme.webp’, file) I need to …

Total answers: 1

TypeError: listdir() takes exactly 1 argument (0 given)

TypeError: listdir() takes exactly 1 argument (0 given) Question: when I execute this in my win10 I get this error. But when I am using: dirs = os.listdir(path) for file in dirs: print(file) I can see all the files in dir, I need help! error: Raw_Files = os.listdir() TypeError: listdir() takes exactly 1 argument (0 …

Total answers: 2

I get "SyntaxError: invalid syntax" for no reason (I think)

I get "SyntaxError: invalid syntax" for no reason (I think) Question: this is the code print(f"{DataBase.Count()} Usersn") and this is the error print(f"{DataBase.Count()} Usersn") ^ SyntaxError: invalid syntax and i dont know how to fix it please help me Asked By: seifahmed15 || Source Answers: You are trying to run Python 3 (in fact Python …

Total answers: 2

Can a string and int comparison be ever True in python2.7

Can a string and int comparison be ever True in python2.7 Question: I know python2.7 allows comparison between different types. So the equality comparison between str and int will result in False. Can the comparison ever be true depending on the values of a and b? a = input(‘we input some string value a’) if …

Total answers: 2

Get the season when entering a month and day (python)

Get the season when entering a month and day (python) Question: I am writing a code that allows the user to enter a month and date and the program will tell them what season it will be given the information that the user entered. What I currently have working is that when you enter certain …

Total answers: 2

How to retrieve the value of 'Avengers'='Endgame'

How to retrieve the value of 'Avengers'='Endgame' Question: ET={‘movies’:[{‘DC’:’Batman’,’Marvel’:[{‘Avengers’:’Endgame’,’Spiderman’:’NowayHome’}]}]} Asked By: QWERTY || Source Answers: If Entertainment is declared as Entertainment = {‘game’:’football’}, {‘other’:[{‘movies’:’NowayHome’},{‘songs’:’latest’}]} The answer will be Entertainment[1][‘other’][0][‘movies’] Answered By: Pto self explained ET = { ‘movies’: [{ ‘DC’: ‘Batman’, ‘Marvel’: [{ ‘Avengers’: ‘Endgame’, ‘Spiderman’: ‘NowayHome’ }] }] } ”’ ET[‘movies’] => select key …

Total answers: 2