Welcome!

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

SignUp Now!

python3

  1. Cooldude100

    Python How do I get paid ads on my website.

    I am making a payment website using stripe. It is sort like paypal or venmo. But you don't need any transaction fees. The way I hope to accomplish this is with ads. I am using anvil but there is no ad option.
  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. 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...
  5. N

    Python I am making a Snake game using turtle and have a "raise terminator turtle.terminator" error.

    I would like it to run rather than terminate itself: #//Snake #Import random for spawns, turle for graphics, time for pauses, and urllib for downloading icon import random import turtle import time import urllib.request #//Downloading... print("Downloading necessary files...") #//Icon download...
  6. skifli

    Python Feedback on a program I made.

    Hi CF, I would like to ask for feedback on a project of mine I made in Python & PHP. It is a program that allows you to wirelessly share files with other devices on your network. Any device that can access the webpage for the server can upload and downloads files. Github...
  7. Lalremruata

    Python How to fetch database row and display in Qlabels with QcomboBox selected value in PyQt5

    I want to fetch database row values and display it in some labels based upon the selected value of combo box. The combo box successfully display 'item_name' from table_1 in the combo box. Now, I want to display 'item_name' relevant row values (like item_price, item_code, item_qty etc) in...
  8. Lalremruata

    Python How to avoid Null or empty value in QLineedit of Pyqt5

    I tried to validate the QLineedit not to be empty without success. I did validator = QRegExpValidator(QRegExp(r'[0-9]+')) self.lineEdit_2.setValidator(validator) it is working. But def temp_var(self, text): cur_txt = text if cur_txt == 'Cheque' or cur_txt == 'Wire Transfer' or...
  9. S

    Python Trying to understand flipping a list

    x = 1 y = 2 x, y, z = x, x, y z, y, z = x, y, z print(x, y, z) The answer here is 1 1 2. My question is how does this process work? I would have thought that the answer would have gone as follows: x = 1, y = 2, z = 1 swap x = 1, x = 2, y = 1 z = 1, y = 1, z = 1 swap x = 1, y = 1, z = 1...
  10. S

    Python Issues with lists in Python

    my_list = [1, 2] for v in range(2): my_list.insert(-1, my_list[v]) print(my_list) The result of this is [1, 1, 1, 2], but I can't honestly comprehend why? Why isn't there a 0 then a 1? why isn't it after the 2 considering it is -1 for the placement in the list? myList = [] for i...
  11. S

    Python How to import and use a module from another Python program online?

    Hi All I'm learning Python. I have created a typical sample module online (specifically on repl.it): # Python Module example def add(a, b): """ This program adds two numbers and returns the result. """ return a + b Here, the module file name is example.py, the module is named...
  12. S

    Python Rearranging elements in Python

    I am confused on lines 9-11, how does elem2 change values, surely it would just say as one since it's just swapping values with it's self? It's confusing because in order for this sequence to work it needs to change, I just don't know how it is doing so. def fib(n): if n < 1...
  13. wolfman456

    Python In over my head

    HI, This is my first post, I have read several post at this point and it looks like you are all a very helpful group and I hope you all are able to assist me and that I will be able to help others in the future. The following project is my first attempt to right a project completely from scratch...
  14. Zyphon_22

    Python Key input in python

    So im working on a text game in python and I first decided to use the time module: import time print("Hello") time.sleep(2) print("How are you") But now i am creating a function and putting it in place of the time module like this: def dialog(): dialog = input("") print("Hi") dialog()...
  15. K

    Python The proper way of class accessing subclass' attributes

    I'd like to ask somebody experienced in Django (or Python in general), how e.g. ModelSerializer accesses attributes created by me? How does it know about my class? I mean django code was written months/years before mine code and in this particular class I'm not calling any method or anything...
  16. Zyphon_22

    Python Running a python file inside a python file (ANSWERED)

    Hi for a project im working on i was wondering is there anyway you could run a python file inside a python file say for instance choice = input(">") if choice == "run" # run a external python file if anyone can tell me a way to run a python file inside one that would be helpful Thanks
  17. S

    Python insert() function printing the list the opposite way

    myList = [] # creating an empty list for i in range(5): myList.insert(0, i + 1) print(myList) I am new to Python and I am wondering why this outputs the numbers backwards. Surely it starts from 0 and not from the last value?
  18. S

    Python Simple confusion for the del instuction

    hatList = [1, 2, 3, 4, 5] hatList[2] = input(int("Enter an integer number: )") del hatList[4] del hatList[-1] print("Lists content: ", hatList) I don't know If I am being stupid but does the del instruction produce a traceback error for line 5 but works for line 6?
  19. S

    Python 'for' loops, 'exp' variable question

    I am wondering what meaning the 'exp' variable in the 'for' loop. On my course I am taking it says it is a 'control variable' but I am struggling to comprehend what that means?
  20. S

    Python Why doesn't this output "three" as well?

    I am wondering why this only outputs "one" and "two" but not three since elif statements condition is met. Thank you in advance :) x = 1 y = 1.0 z = "1" if x == y: print("one") if y == int(z): print("two") elif x == y: print("three") else: print("four")
Back
Top Bottom