Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: TreeView column headers
Post: RE: TreeView column headers
I've uploaded a bare bones basics of all you need to do to create a treeview. I hope it helps.
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
root.title('Student Scores')
root.geometry('... |
|
BashBedlam |
General Coding Help |
2 |
2,145 |
Jan-29-2023, 04:19 AM |
|
|
Thread: converting to int
Post: RE: converting to int
(Jul-24-2022, 10:41 PM)Skaperen Wrote: just a quick look at it doesn't show me how it would get the value 345 from the string "345foo99boo123" or the value 65533 from the string "0xfffdummyfff".Sorr... |
|
BashBedlam |
General Coding Help |
11 |
2,633 |
Jul-25-2022, 08:33 PM |
|
|
Thread: converting to int
Post: RE: converting to int
Here is an example of one way to do that in Python3.
digit_counter = {'1': 0, '2': 0, '3': 0, '4': 0,
'5': 0, '6': 0, '7': 0, '8': 0, '9': 0}
white_space_counter = {' ': 0, '\n':0, '\t':0}
user_inpu... |
|
BashBedlam |
General Coding Help |
11 |
2,633 |
Jul-23-2022, 07:52 PM |
|
|
Thread: If 2nd input in the game is correct, replace with 1st input and loop the game
Post: RE: If 2nd input in the game is correct, replace w...
Always happy to help **smile** |
|
BashBedlam |
Game Development |
11 |
4,100 |
Jul-16-2022, 02:44 PM |
|
|
Thread: If 2nd input in the game is correct, replace with 1st input and loop the game
Post: RE: If 2nd input in the game is correct, replace w...
Okay, sorry. I think I understand now. Try this:
first_data=input('enter a country name: ')
while True :
print(first_data)
last_letter=str(first_data[-1]).lower ()
print(last_letter)
second_data=i... |
|
BashBedlam |
Game Development |
11 |
4,100 |
Jul-15-2022, 06:43 PM |
|
|
Thread: If 2nd input in the game is correct, replace with 1st input and loop the game
Post: RE: If 2nd input in the game is correct, replace w...
(Jul-15-2022, 04:20 PM)tylerdurdane Wrote: Ok can you modify the code to exit if you reply wrong ?and keep going if you reply correctly or quit either way? |
|
BashBedlam |
Game Development |
11 |
4,100 |
Jul-15-2022, 06:34 PM |
|
|
Thread: If 2nd input in the game is correct, replace with 1st input and loop the game
Post: RE: If 2nd input in the game is correct, replace w...
This is the output I get when the answer is correct.
Output:enter a country name: africa
africa
a
enter a country name starts with the last letter of previous country name: americaThis is the answer I... |
|
BashBedlam |
Game Development |
11 |
4,100 |
Jul-15-2022, 04:03 PM |
|
|
Thread: If 2nd input in the game is correct, replace with 1st input and loop the game
Post: RE: If 2nd input in the game is correct, replace w...
(Jul-15-2022, 08:50 AM)tylerdurdane Wrote: What I need is: do not restart the game. Take the 2nd input and consider as 1st and keep asking for 2nd input.So, to clarify... Is something like this what... |
|
BashBedlam |
Game Development |
11 |
4,100 |
Jul-15-2022, 12:50 PM |
|
|
Thread: list digit into number
Post: RE: list digit into number
This is how I would go about it:
def to_number (digits) :
string_result = ''
for number in digits :
string_result += str (number)
return int (string_result)
print (to_number ([21, 12, 1]))Outpu... |
|
BashBedlam |
Homework |
2 |
1,521 |
Jul-10-2022, 05:02 PM |
|
|
Thread: Changing a string value to a numerical value using python code and a lamda function
Post: RE: Changing a string value to a numerical value u...
(Jul-05-2022, 06:06 PM)Led_Zeppelin Wrote: It seems simple and fast. It is using lambda function of which, I know little, hence the post. Will it do all the
entries in the column? There are 220320 ... |
|
BashBedlam |
General Coding Help |
6 |
1,598 |
Jul-05-2022, 10:57 PM |
|
|
Thread: Changing a string value to a numerical value using python code and a lamda function
Post: RE: Changing a string value to a numerical value u...
Personally, I would useindex ()and a look-up table like this:
sensor_data = {'machine_status': 'BROKEN'}
sensor_data ['label'] = 'NBR'.index (sensor_data ['machine_status'][0])
print (sensor_data)Out... |
|
BashBedlam |
General Coding Help |
6 |
1,598 |
Jul-05-2022, 02:41 PM |
|
|
Thread: TypeError: float() argument must be a string or a number, not 'list'
Post: RE: TypeError: float() argument must be a string o...
If you plug-in these values and call your functiongenerateK ([1, 2, 3], [1, 2, 3], [1, 2], 1)then it works as expected like so.
Output: The secret value recovered k: 3It would seem that the problem is... |
|
BashBedlam |
General Coding Help |
2 |
4,849 |
Jul-01-2022, 12:31 PM |
|
|
Thread: Shopping cart program
Post: RE: Shopping cart program
This whole thing would be significantly easier if you could us a dictionary for your cart. The item name would be the key and the price would be the value. If you've been taught about dictionaries, I ... |
|
BashBedlam |
Homework |
7 |
18,830 |
Jun-26-2022, 11:58 PM |
|
|
Thread: find some word in text list file and a bit change to them
Post: RE: find some word in text list file and a bit cha...
Are you searching for exactly V_20220412or do you need every occurrence of an eight character sequence that begins withV_or something else? |
|
BashBedlam |
General Coding Help |
3 |
1,519 |
Jun-26-2022, 11:03 PM |
|
|
Thread: select files such as text file
Post: RE: select files such as text file
This is how I would do it:
import os
import shutil
with open ("pattern_list.txt") as pattern_list_file :
pattern_data = pattern_list_file.read ()
pattern_list = pattern_data.split ('\n') [:-1]
file... |
|
BashBedlam |
General Coding Help |
2 |
1,163 |
Jun-25-2022, 03:20 PM |
|
|
Thread: matching a repeating string
Post: RE: matching a repeating string
Ifbarwill always be a single character repeated an number of times thenif foo in bar :would be the most straight forward test to see ifbarisfoorepeated. |
|
BashBedlam |
General Coding Help |
2 |
1,236 |
Jun-23-2022, 09:28 PM |
|
|
Thread: For loop + add something
Post: RE: For loop + add something
Is this what you're looking for?
car_list = ['Ford', 'Volvo', 'BMW']
for car in car_list :
print (f'The {car} has been sold.')
print (f'There were {len (car_list)} cars sold.')Output:The Ford has b... |
|
BashBedlam |
General Coding Help |
10 |
2,249 |
Jun-23-2022, 09:16 PM |
|
|
Thread: I have no clue what I am doing wrong here
Post: RE: I have no clue what I am doing wrong here
Try it like this:
def multiply(amount_of_cable,b):
result=int(amount_of_cable)*0.87
return result
message="Thank You for Choosing Robert's Fiberoptics! The One-Stop-Shop for all your fiberoptics ne... |
|
BashBedlam |
General Coding Help |
4 |
1,366 |
Jun-18-2022, 06:04 PM |
|
|
Thread: formatting float like int for whole values
Post: RE: formatting float like int for whole values
You said that you want this:
Output:>>> foo(3.25)
'3.25'
>>> foo(4.0)
'4'
>>> and I gave you this:
Output:>>> def foo (floating_point_number) :
... integer = in... |
|
BashBedlam |
General Coding Help |
8 |
1,733 |
Apr-11-2022, 01:24 PM |
|
|
Thread: formatting float like int for whole values
Post: RE: formatting float like int for whole values
Do you mean like this?
def foo (floating_point_number) :
integer = int (floating_point_number)
if integer == floating_point_number :
print (integer)
else :
print (floating_point_number)
foo (3... |
|
BashBedlam |
General Coding Help |
8 |
1,733 |
Apr-10-2022, 08:21 PM |