Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

python

  1. 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.
  2. 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...
  3. 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...
  4. 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('...
  5. 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...
  6. 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...
  7. 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.
  8. 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...
  9. 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...
  10. 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...
  11. 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 =...
  12. 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...
  13. 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))...
  14. User8574

    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...
  15. 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...
  16. T

    Python How can I write a program in Python that presses "a" and "d"?

    Hi there, I've been trying for a long time today to write a program in python which presses the "a" key for 20 seconds, then pauses for 2 seconds and then presses the "d" key for 20 seconds and this should repeat infinitily. But I couldn't do that. If someone could help me, that would be very...
  17. Freeto_India

    Python Read xls and xlsx file to write it in csv file using python

    Hi All, I have 2 -> .XLS files (with header), 1 -> .XLSX file and 1 -> .XLSX file (password protected) I have to read these files optimally and create respective .CSV files - What would be the best optimized approach? - What are the necessary libraries required? Can one library solve this...
  18. esqhol

    My python learning app

    Hello, I recently published an app that I built for google play, I would like to reviews from you about the app and suggestions for improvements. The app is made for python learning, practice, and competing against online players. App name: Sigma- code wars Link...
  19. T

    Python I want to implement a bootstrap method to get the 95% confidence intervals for a cumulative rate

    Hello, I basically have worked out a cumulative rate and have it as a pandas column, see attached below: The confidence bounds I want are for the column CumSum which was calculated from taking all individual rates (Rind ) so Cumsum[0] is the sum of all Rind from Rind[0] to Rind[1663] and...
  20. N

    Lua explaining the structure of two functions in Lua

    Hi everyone, I am trying to integrate a code which is a variational auto encoder model (where the prior of the VAE is a mixture of Gaussians) from Lua (torch) to pytorch as part of my model and I have a hard time to fully understand the Lua script (I didn't find a tutorial of the language)...
Back
Top Bottom