Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: leading zero number formatting
Post: RE: leading zero number formatting
(Jan-27-2019, 04:15 PM)buran Wrote: >>> guess = 0
>>> '{:0>4d}'.format(guess)
'0000'
Excellent, but the first printed guess, 0000 did not appear, so I moved the guess incremento... |
|
RedSkeleton007 |
General Coding Help |
3 |
3,967 |
Jan-27-2019, 04:56 PM |
|
|
Thread: leading zero number formatting
Post: leading zero number formatting
Hi, I want to print out lock combination guesses, all as 4 digits with leading zeros as needed (0000, 0001, 0002, etc.), but I'm having trouble:
#!/usr/bin/env python3
#MoreOnLoops.py
#pad lock guess... |
|
RedSkeleton007 |
General Coding Help |
3 |
3,967 |
Jan-27-2019, 04:14 PM |
|
|
Thread: Unexpected ininite loop behavior
Post: RE: Unexpected ininite loop behavior
Thanks for the quick response. It works now:
#!/usr/bin/env python3
print("Welcome to the Miles Per Gallon Program.")
print()
while True:
milesDriven = float(input("Enter miles driven: ... |
|
RedSkeleton007 |
General Coding Help |
4 |
2,680 |
Jan-27-2019, 03:34 PM |
|
|
Thread: Unexpected ininite loop behavior
Post: Unexpected ininite loop behavior
Hi, I'm trying to code a basic while True loop, but I get an infinite loop whether or not I use the continue statement (after I purposely enter invalid data to test the loop):
#!/usr/bin/env python3
... |
|
RedSkeleton007 |
General Coding Help |
4 |
2,680 |
Jan-27-2019, 03:23 PM |
|
|
Thread: Populating a list with divisors
Post: Populating a list with divisors
I did Python Practice Exercise 4 from here:
https://www.practicepython.org/solution/...tions.html
The resulting code is:
#!/usr/bin/env python3
#PracticePythonExercise04.py
num = int(input("Enter a ... |
|
RedSkeleton007 |
General Coding Help |
1 |
2,202 |
Aug-21-2018, 12:26 AM |
|
|
Thread: How to detect semantic errors with numbers more complex than integers?
Post: How to detect semantic errors with numbers more co...
I've wrote a program that calculates a the average MPH speed of a race whose distance is measured in kilometers by default. My program runs, but I can't figure out how to verify I'm not getting any se... |
|
RedSkeleton007 |
General Coding Help |
1 |
2,434 |
Aug-01-2018, 03:36 AM |
|
|
Thread: How to detect and tell user that no matches were found in a list
Post: RE: How to detect and tell user that no matches we...
woooee, I had to alter your code, because the user_num argument in your code was not defined.
Also, I managed to make my program work using an empty list called smallerNums:
#!/usr/bin/env python3
#... |
|
RedSkeleton007 |
General Coding Help |
6 |
3,937 |
Jul-19-2018, 03:21 AM |
|
|
Thread: How to detect and tell user that no matches were found in a list
Post: RE: How to detect and tell user that no matches we...
(Jul-17-2018, 03:38 AM)micseydel Wrote: Write a function that returns true if you find it, and returns false after the loop if not.
Remember, we need the program to not just return false if no numbe... |
|
RedSkeleton007 |
General Coding Help |
6 |
3,937 |
Jul-17-2018, 04:38 AM |
|
|
Thread: How to detect and tell user that no matches were found in a list
Post: How to detect and tell user that no matches were f...
It's one thing to tell someone we have reached the end of a list, but how do we tell the user if no matches were found?
#!/usr/bin/env python3
#PracticePythonExercise03.py
myList = [0,2,5,4,6,7,9,8]... |
|
RedSkeleton007 |
General Coding Help |
6 |
3,937 |
Jul-17-2018, 03:36 AM |
|
|
Thread: TypeError: not all arguments converted during string formatting
Post: TypeError: not all arguments converted during stri...
Why is a basic print statement asking for string formatting?:
#!/usr/bin/env python3
#PracticePythonExercise02.py
number = input("Enter a number: ")
if number % 2 == 0:
print("the number is eve... |
|
RedSkeleton007 |
General Coding Help |
1 |
14,993 |
Jul-15-2018, 08:02 PM |
|
|
Thread: How do I print a returned variable calculated in another function?
Post: How do I print a returned variable calculated in a...
Hi all. My comprehension of how to use scope is not clicking. From the following code:
#!/usr/bin/env python3
#PracticePythonExercise01.py
#Create a program that asks the user to enter their name an... |
|
RedSkeleton007 |
General Coding Help |
3 |
3,567 |
Jul-10-2018, 02:25 AM |
|
|
Thread: FileNotFoundError: [Errno 2] No such file or directory: 'movies.csv'
Post: RE: FileNotFoundError: [Errno 2] No such file or d...
(Jul-01-2018, 06:30 PM)buran Wrote: in readMovies() function, you open the file in 'r' mode. in read mode if the file does not exists, it is not created.
If this line:
FILENAME = "movies.csv"Does no... |
|
RedSkeleton007 |
General Coding Help |
5 |
15,215 |
Jul-01-2018, 07:50 PM |
|
|
Thread: FileNotFoundError: [Errno 2] No such file or directory: 'movies.csv'
Post: FileNotFoundError: [Errno 2] No such file or direc...
I tried to run my movie list program:
#!/usr/bin/env python3
#MovieListCSV.py
#This program does pretty much the same thing as MovieList2D.py. The only
#difference about this program is that it calls... |
|
RedSkeleton007 |
General Coding Help |
5 |
15,215 |
Jul-01-2018, 06:20 PM |
|
|
Thread: I'm trying to create a simple yes/no dialog box
Post: RE: I'm trying to create a simple yes/no dialog bo...
(Apr-24-2018, 06:01 PM)nilamo Wrote: import filename?Pretty much. It's exactly like importing a module function:
#!/usr/bin/python
#YesNoPopup.py
from tkinter import *
import tkinter.messagebox
imp... |
|
RedSkeleton007 |
GUI |
15 |
18,732 |
Apr-25-2018, 10:13 AM |
|
|
Thread: Still confused about how passing arguments works
Post: Still confused about how passing arguments works
I have a simple user input program:
#!/usr/bin/python
#QuickTest.py
def getLocation(x,y,z):
x = input("Specify horizontal position: ")#latitude
y = input("Specify vertical position: ")#longi... |
|
RedSkeleton007 |
General Coding Help |
3 |
2,989 |
Apr-25-2018, 09:46 AM |
|
|
Thread: I'm trying to create a simple yes/no dialog box
Post: RE: I'm trying to create a simple yes/no dialog bo...
Cool. What about my question in post 11 of how to invoke another python program:
if answer == 'yes':
tkinter.messagebox.showinfo('Program activated.', 'You have been hacked!')
#code t... |
|
RedSkeleton007 |
GUI |
15 |
18,732 |
Apr-24-2018, 05:25 AM |
|
|
Thread: I'm trying to create a simple yes/no dialog box
Post: RE: I'm trying to create a simple yes/no dialog bo...
Fellas, I found a youtube tutorial that had exactly what I was looking for:
#!/usr/bin/python
#YesNoPopup.py
from tkinter import *
import tkinter.messagebox
def ask_question():
answer = tkinter... |
|
RedSkeleton007 |
GUI |
15 |
18,732 |
Apr-20-2018, 07:51 AM |
|
|
Thread: I'm trying to create a simple yes/no dialog box
Post: RE: I'm trying to create a simple yes/no dialog bo...
For some reason, despite defining all of the buttons, labels, and packing them, my window comes up blank when I run the program:
#!/usr/bin/python
#BackdoorLogin_DialogBox.py
import tkinter as tk#fo... |
|
RedSkeleton007 |
GUI |
15 |
18,732 |
Apr-19-2018, 10:08 AM |
|
|
Thread: I'm trying to create a simple yes/no dialog box
Post: RE: I'm trying to create a simple yes/no dialog bo...
(Apr-19-2018, 05:07 AM)Larz60+ Wrote: after line 12 (in my code) add:
self.parent.withdraw()That should do the trickSorry, but that didn't do anything. |
|
RedSkeleton007 |
GUI |
15 |
18,732 |
Apr-19-2018, 06:10 AM |
|
|
Thread: I'm trying to create a simple yes/no dialog box
Post: RE: I'm trying to create a simple yes/no dialog bo...
The code in Larz60+'s post produced the same unwanted result as my following updated code:
#!/usr/bin/python
#BackdoorLogin_DialogBox.py
from tkinter import *
import tkinter.messagebox
import sys
ro... |
|
RedSkeleton007 |
GUI |
15 |
18,732 |
Apr-19-2018, 04:04 AM |