Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: I have written a program that outputs data based on GPS signal
Post: RE: I have written a program that outputs data bas...
Could you put the os.system('clear') at the beginning of the While Loop? |
|
mcmxl22 |
General Coding Help |
1 |
1,133 |
Jul-22-2022, 12:10 AM |
|
|
Thread: positional argument: 'self'
Post: RE: positional argument: 'self'
(Dec-12-2021, 08:54 PM)snippsat Wrote: A more normal and standard way to do this menator01.
import random
class Word:
def __init__(self, word_list):
self.word_list = word_list
def ... |
|
mcmxl22 |
General Coding Help |
8 |
3,194 |
Dec-12-2021, 09:10 PM |
|
|
Thread: positional argument: 'self'
Post: RE: positional argument: 'self'
(Dec-12-2021, 08:08 PM)menator01 Wrote: remove self and it will work as expectedI'm trying to learn how to use classes and functions with the "self" argument. Removing it doesn't teach me anything. |
|
mcmxl22 |
General Coding Help |
8 |
3,194 |
Dec-12-2021, 08:16 PM |
|
|
Thread: positional argument: 'self'
Post: positional argument: 'self'
I write the following code and get the following error.
import random
word_list = ['a', 'ranom', 'list', 'of', 'words']
class Word:
def get_word(self):
words = random.choice(word_li... |
|
mcmxl22 |
General Coding Help |
8 |
3,194 |
Dec-12-2021, 07:50 PM |
|
|
Thread: Inventory System
Post: RE: Inventory System
An updated version with no dependencies.
#!/usr/bin/env python3
"""
Inventory.py
Python 3.7
"""
import json
from os import path, system
from sys import platform
def clear_screen():
"""Clear t... |
|
mcmxl22 |
Code sharing |
3 |
2,780 |
Oct-01-2021, 08:29 PM |
|
|
Thread: Inventory System
Post: RE: Inventory System
(Sep-30-2021, 09:16 PM)Yoriz Wrote: Where did you learn your unique use of classes?I'm still trying to wrap my head around how to use them. This was the best I could come up with for this program. |
|
mcmxl22 |
Code sharing |
3 |
2,780 |
Sep-30-2021, 09:22 PM |
|
|
Thread: Inventory System
Post: Inventory System
A command-line inventory system I wrote.
The dependencies are here.
#!/usr/bin/env python3
"""
Inventory.py
Requires: numli.py, clear_screen.py
Python 3.7
"""
import json
from os import path
from c... |
|
mcmxl22 |
Code sharing |
3 |
2,780 |
Sep-30-2021, 09:12 PM |
|
|
Thread: Python TDD
Post: RE: Python TDD
(Aug-12-2020, 06:31 AM)ndc85430 Wrote: Also, why do you need line 18? The test framework will report pass or fail depending on the assertions; you don't need to do anything more usually.That is just... |
|
mcmxl22 |
General Coding Help |
3 |
2,038 |
Aug-12-2020, 06:36 AM |
|
|
Thread: Python TDD
Post: Python TDD
I am trying to go through Test-Driven Development with Python.
I am currently in section 1 chapter 2.
I have installed Django and selenium.
I have made manage.py
import os
import sys
if __name__ == "... |
|
mcmxl22 |
General Coding Help |
3 |
2,038 |
Aug-12-2020, 05:44 AM |
|
|
Thread: empty json file error
Post: empty json file error
I wrote this and since it creates an empty file it give me an error.
with open("food.json", "r+") as file:
food = json.load(file)Error:Traceback (most recent call last):
File "c:/Users/User/MySt... |
|
mcmxl22 |
General Coding Help |
1 |
9,981 |
Jun-17-2020, 09:50 AM |
|
|
Thread: list sorting question
Post: RE: list sorting question
lists are referenced by index starting at 0 with syntax like list[index_number] or list[0].
elem[0] is equal to lst[0] or (2, 2). |
|
mcmxl22 |
General Coding Help |
5 |
2,720 |
Jun-17-2020, 09:38 AM |
|
|
Thread: pip install -e ., ERROR: Failed building wheel for pyfarmhash
Post: RE: pip install -e ., ERROR: Failed building wheel...
Do you have wheel installed? pip install wheel |
|
mcmxl22 |
General Coding Help |
1 |
6,232 |
Jun-09-2020, 08:24 PM |
|
|
Thread: RuntimeWarning: invalid value encountered in greater
Post: RE: RuntimeWarning: invalid value encountered in g...
|
mcmxl22 |
General Coding Help |
2 |
3,700 |
May-28-2020, 12:44 AM |
|
|
Thread: How to call bash on Python and put the result to the variable?
Post: RE: How to call bash on Python and put the result ...
Try using os.system("echo hfhfggccaggccagccafff | grep -Po '(.*)\K\1' | awk 'length > l {l=length;s=$0} END{print s}").
You will need to import os. |
|
mcmxl22 |
Homework |
4 |
2,679 |
May-28-2020, 12:33 AM |
|
|
Thread: Closing Files - CSV Reader/Writer
Post: RE: Closing Files - CSV Reader/Writer
You can use something like os.remove("file_name.csv") to remove unwanted files. |
|
mcmxl22 |
General Coding Help |
2 |
2,564 |
May-28-2020, 12:29 AM |
|
|
Thread: randomization code in rock, paper, scissors
Post: RE: randomization code in rock, paper, scissors
I think your problem is on line 26.
if computer_choice_history[0] == computer_choice_history[1]:
it should be:
if computer_choice_history[0] == computer_choice_history[0]:
Remember list[0] is the fi... |
|
mcmxl22 |
Game Development |
4 |
2,647 |
May-28-2020, 12:04 AM |
|
|
Thread: Write tables from Word (.docx) to Excel (.xlsx) using xlsxwriter
Post: RE: Write tables from Word (.docx) to Excel (.xlsx...
Don't zip the keys and text into a dict. Put them into the columns and rows as shown here. |
|
mcmxl22 |
General Coding Help |
1 |
3,139 |
May-27-2020, 11:47 PM |
|
|
Thread: inconsistent map() behavior
Post: RE: inconsistent map() behavior
@GOTO10 With isalpha() I don't need number_list! Thanks! |
|
mcmxl22 |
General Coding Help |
2 |
2,178 |
May-23-2020, 10:17 PM |
|
|
Thread: inconsistent map() behavior
Post: inconsistent map() behavior
I am trying to use map() and range() to make a list of numbers that return as strings. I want to use it to make sure users don't enter numbers when they are supposed to enter letters. I wrote an if/el... |
|
mcmxl22 |
General Coding Help |
2 |
2,178 |
May-23-2020, 09:21 PM |
|
|
Thread: calling a variable in a for loop in windows
Post: RE: calling a variable in a for loop in windows
You can use system().
installs pip-review.
system("pip install --user pip-review")
clears screen.
system("clear")
Note: The commands must be strings. |
|
mcmxl22 |
General Coding Help |
1 |
1,775 |
Apr-02-2020, 05:21 PM |