helper

how to sort data inside text file in accending order in python?

how to sort data inside text file in accending order in python? Question: I have a text file containing number integer and string value pairs I want to sort them in ascending order but I am not getting it correct **TextFile.txt ** 87,Toronto 45,USA 45,PAKISTAN 33,India 38,Jerry 30,Tom 23,Jim 7,Love 38,Hate 30,Stress My code def …

Total answers: 3

how to position an ascii isosceles pyramid

ascii pattern in pyhton Question: I created a code for a hollow rectangle but i’m having trouble putting putting an upright isosceles pyramid inside the rectangle. can anyone help how can I squeeze the code for a pyramid inside a rectangle? here is what it supposed to look like my code output vs. the right …

Total answers: 1

How to find the closest number from summed numbers with showing which numbers are used

How to find the closest number from summed numbers with showing which numbers are used Question: I’m doing a project where I have a list of number random numbers get choosen from it: list = [1,2,3,4,5,6,7,8,9] for i in range(5): first = int(random.choice(list)) second = int(random.choice(list)) third = int(random.choice(list)) sumofall = (first + second + …

Total answers: 3

Solving this kata from codewars ,any tips/fixing ? (new to python)

Solving this kata from codewars ,any tips/fixing ? (new to python) Question: So i have this kata: In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative? Example: make_negative(1) # return -1 make_negative(-5) # return -5 make_negative(0) # return 0 and i tried …

Total answers: 3