python

  1. shivambhatele

    Python Which Python Framework is more Flexible in Large Projects?

    Hello All, I am new in python programming and got the opportunity to work on a large project which is based on finance domain. I want to know which python framework is more flexible between Flask and Django in a large project. I have asked this quey on Quora and according to this source, Django...
  2. amirgh21593

    Python Solving Supply Chain Logistics Problem with Ant Colony Optimization

    Hi! I'm currently working on my university project. the link to the article which I'm referencing is Accelerating supply chains with Ant Colony Optimization across a range of hardware solutions and its dataset is available Supply Chain Logistics Problem Dataset. I would appreciate it if there is...
  3. P

    Python Best way to rerun this snippet of code:

    New to python3 working on a fantasy character generator, tyring to find the best way to rerun the snippet of code if the wrong letters are entered in input. Thanks for any help you can give me. #Code to exit or reginirate script quittogen = input("""\nDo you want to quit or generate another...
  4. voldyy

    Python Digit into number

    Hi, how can i change this code to work for two-digit numbers or three-digit number? For now only work for single digit numbers, tried to change algorthm but didnt work. def to_number(digits): result=digits[0] for el in digits[1:]: result=result*10 result=result + el...
  5. stevan

    Python Python compiling error (Python Beginner)

    I'm trying to get data from my temperature and humidity sensor and write the data to a JSON file every minute. I started learning Python two days ago, so I have no idea why these errors occur (the output is in the attachment): The Code: import time import board import adafruit_dht import...
  6. C

    Python Request for help with basic statistics using NumPy

    Please see the attachments. I do not understand how to insert the required numbers. Many thanks in advance for any wisdom you may proffer.
  7. notaverygoodprogrammer

    Python How to fix beginner project issue (Guess the Number game)

    Hi, I'm working on a small game where the computer generates a number, and you have to input (like guess) a random number. Then, the computer will tell you whether the guessed number is too big or too small, or if you guessed it right. I might not have imported the random number correctly, but...
  8. AzureEyed

    Python Python - simple beginner question

    Hello, I wanted to ask for a shortcut to mark multiple lines and put them as comment, I don't mind if each line has # at the beginning for example: The code is: 1. print("hello world") 2. print("hello world") 3. print("hello world") I want to make it: 1. # print("hello world") 2. # print("hello...
  9. choppingbl0ck

    Python What's an alternate solution to building a pyramid?

    This is what I have so far. I'm told it's not acceptable. Any ideas on a different way to do this? I have to use loops def print_pyramid(str,h): if str=="right": for i in range(h): print('#' * (i+1)) elif str=="left": for i in range(h): print('...
  10. Avi.Parker

    Python Pandas pd.date_range() HELP

    <start = dt.datetime(2022,1,1) end = dt.datetime(2023,1,1) dates = pd.date_range (start,end,freq='20D') print(dates)> I am the definition of a newbie to python, not to mention the pandas extension, That being said is there any way that I can have the pd.date_range() line count from the end...
  11. luckyoi

    Python Is programming for everyone?

    Hello everyone! I am kind of new in programming and I have some troubles learning and I was wondering; is programming really for everyone? I am 19 years old and I've been mostly editing codes rather then making own (with no intention of stealing but just messing around to have fun). I've tried...
  12. C

    Answered Request for Help with List Methods in Python

    Please find attached a screenshot of an error message pertaining to my code from an exercise in list methods in Python, specifically count() and index(). If anyone has any constructive criticisms or suggestions, I will be most grateful. Many thanks in advance for all your help.
  13. chrswe03

    Python What should be my next steps to solve this sorting/resolving issue?

    Hi all, first post here. Working on a project for corp, we take in lots of emails and need to process them accordingly, my role is to automate this process however possible.. What I've done so far: - Grab the email, convert it out of .msg format and into a more friendly format. - Developed the...
  14. C

    Answered Request for help with printing strings in Python

    Please see a directive which I am having trouble fulfilling: # Use upper() on place: place_up place_up = upper(place, place_up) I received this error message: NameError: name 'upper' is not defined Please see the code in context, attached. There are probably more errors which I have not...
  15. Casm

    Python How to repair the corrupted image below using opencv, python, numpy and necessary libraries

    import cv2 damaged_image = cv2.imread("Corrupted.png") mask = cv2.imread("mask.png", 0) output = cv2.inpaint(damaged_image, mask, 1, cv2.INPAINT_TELEA) cv2.imshow('test', output) cv2.waitKey(0) cv2.destroyAllWindows() I couldn't generate mask with python, i have drawn the mask by using Paint...
  16. G

    Python Not sure how I can fix my code for a small turtle feeding game (in turtle) :)

    Hi, I'm having some issues with this section of my code, it has errors in Terminal and the feedback isn't very specific. Thanks!! import turtle import time variable1=turtle # turtle object #img_turtle = Turtle.fish() #turtle.register_shape('turtle.gif') #img_turtle.shape('turtle.gif') speed =...
  17. shayman23

    Python Python Probability problem

    Suppose every day you wake up and you are randomly in a GOOD mood 60% of the time or in a BAD mood 40% of the time. Furthermore, anytime you have a quiz or test in a course, the grade you receive is also random based on the following: If you take a quiz or exam when you are in a GOOD mood...
  18. timotheetremblais

    Python How to call a float in this function ?

    I have defined those three functions: ``` def deriv(y,x) : dx = 10**(-5) dx2 = dx/2 return ((y(x+dx2)-y(x-dx2))/(dx)) def fex(y,x) : y_0 = y(x) return (np.sqrt(1 + deriv(y,x)**2))/(np.sqrt(2*9.81*(y_0-y(x)))) def tang(y,a,x): y_a= y(a) return(y_a+deriv(y,a)*(x-a))...
  19. getrickrolled

    Python .get doesn't seem to work :/

    digit_mapping = { "1" == "One", "2" == "Two", "3" == "Three", "4" == "Four" } phone = input("Phone: ") output = "" for digits in phone: output = output + digit_mapping.get(digits, "!") + " " print(output) The .get function is shown as an error (btw this is Python...
  20. cegbuji14

    HTML Problem loading local Json file

    Hi, im currently using Python's Flask to create a dashboard and on one route I'd like to render an html template that turns a local json file into a table. When using getJSON for some reason the localhost/server cannot find the file no matter how I've defined the path so the table always only...
Top