Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: while loop help
Post: RE: while loop help
(May-08-2017, 02:20 AM)jhall710 Wrote: I keep getting the same output [4, 5, 2, 6, 8] instead of [2, 4, 5, 6, 8]
here's my code
list_ = [6,8,4,5,2]
I = 0
J = 999
while I < 5:
J = 0
while ... |
|
smbx33 |
Homework |
15 |
9,279 |
May-08-2017, 08:59 PM |
|
|
Thread: Total after tax
Post: RE: Total after tax
(Apr-27-2017, 06:37 AM)buran Wrote: (Apr-27-2017, 04:26 AM)PyPhanman Wrote: Try this...Note that your code is not related to the OP specific question, which has been answered more than a day ago. ... |
|
smbx33 |
Homework |
5 |
5,330 |
Apr-27-2017, 07:52 AM |
|
|
Thread: while loop help
Post: RE: while loop help
list_ = [6,8,4,5,2]
I = 0
J = 999
while I < 5:
J = 0
while J < 4:
if list_[J]> list_[J+1]: # This if statement will check values in list and then...
list_[J],list_[... |
|
smbx33 |
Homework |
15 |
9,279 |
Apr-27-2017, 07:28 AM |
|
|
Thread: Error in loops, new to Python
Post: RE: Error in loops, new to Python
For question one, I feel most of those steps are unnecessary as you would get the same answer from some thing like:
list_ = [4.5,6,120.5,9,1,2]
s = sum(list_)
print((s/len(list_)))I tried to convert ... |
|
smbx33 |
Homework |
20 |
12,400 |
Apr-25-2017, 05:18 AM |
|
|
Thread: Error in loops, new to Python
Post: RE: Error in loops, new to Python
Thank you all, I have a deeper understanding of why I was wrong in deleting items off the same list that I am iterating over :P Even though its a bug and gives undesired results(sometimes). Since it w... |
|
smbx33 |
Homework |
20 |
12,400 |
Apr-24-2017, 08:49 PM |
|
|
Thread: Error in loops, new to Python
Post: RE: Error in loops, new to Python
(Apr-24-2017, 03:43 AM)nilamo Wrote: Modifying a list while you're in the middle of iterating over that same list is very dangerous.
you are defiantly correct! (I had to look it up)
I still don't u... |
|
smbx33 |
Homework |
20 |
12,400 |
Apr-24-2017, 04:32 AM |
|
|
Thread: Nested loops, lists and if statements
Post: RE: Nested loops, lists and if statements
I took my code down it doesn't help that you also have a copy of it quoted.
Even though I don't think the code provided is doing the work for him per say. |
|
smbx33 |
Homework |
10 |
8,987 |
Apr-23-2017, 11:05 AM |
|
|
Thread: Sorting ID with first and last name Arrays
Post: RE: Sorting ID with first and last name Arrays
I don't know what min2max list was but hopefully it wasn't important ^_^. Maybe I'm starting to get sleepy.
for a random_id you could put a for loop that will put a random int for every name in firstn... |
|
smbx33 |
Homework |
9 |
9,949 |
Apr-23-2017, 10:54 AM |
|
|
Thread: Error in loops, new to Python
Post: RE: Error in loops, new to Python
I made minor modifications to the existing code and provided explanation.
list_ = [4,6,12,9,1,2]
s = 0
c = 0
x = 999
while len(list_) >0: # here you had list[0] I think you wanted to stop when le... |
|
smbx33 |
Homework |
20 |
12,400 |
Apr-23-2017, 10:19 AM |
|
|
Thread: identifying some forum software
Post: RE: identifying some forum software
In the source it states powered by "www.discourse.org".
Check out their security section: https://github.com/discourse/discourse/b...ECURITY.md |
|
smbx33 |
Bar |
4 |
82,856 |
Apr-23-2017, 08:46 AM |
|
|
Thread: Help? Letter Grade assignment..
Post: RE: Help? Letter Grade assignment..
You could put in if statement after every variable that will ask for same input IF input does not meet the criteria, in this case its a number being over 100.
score = int(input("Enter your first exam... |
|
smbx33 |
Homework |
3 |
4,594 |
Apr-23-2017, 05:20 AM |
|
|
Thread: Nested loops, lists and if statements
Post: RE: Nested loops, lists and if statements
(Apr-23-2017, 04:50 AM)Liquid_Ocelot Wrote: Hey man I appreciate the help. much clearer now and I'll deff use that reference in future :)
No problem man! Lets learn together! |
|
smbx33 |
Homework |
10 |
8,987 |
Apr-23-2017, 05:09 AM |
|
|
Thread: Nested loops, lists and if statements
Post: RE: Nested loops, lists and if statements
Not sharing my solution but will include sample code related to my solution.
For reference, I used : Understanding nested list comprehension syntax in Python |
|
smbx33 |
Homework |
10 |
8,987 |
Apr-23-2017, 04:16 AM |
|
|
Thread: Python Exercise: Generate a two-dimensional array
Post: RE: Python Exercise: Generate a two-dimensional ar...
row_num = int(input("Enter number of rows \n: "))
col_num = int(input("Enter number of columns \n: "))
#d_array = np.zeros((row_num, col_num))--useless
shape = row_num, col_num #shape = d_array.sha... |
|
smbx33 |
Homework |
4 |
10,855 |
Apr-22-2017, 11:51 PM |
|
|
Thread: New Users Introduce Yourself
Post: RE: New Users Introduce Yourself
Hello!
My name is John and I am a 27 yrs old. I am new to programming but I have been fascinated by and owned a computer since windows 95 (I don't know if that's old or not but I was 6). My goal is ... |
|
smbx33 |
Bar |
431 |
230,523 |
Apr-21-2017, 06:00 AM |
|
|
Thread: Python Exercise: Generate a two-dimensional array
Post: RE: Python Exercise: Generate a two-dimensional ar...
(Apr-20-2017, 10:03 PM)ichabod801 Wrote: The variable names i, j, r, and c are bad variable names. They are not descriptive. Note how the example use row and col.
So, explaining from the example: m... |
|
smbx33 |
Homework |
4 |
10,855 |
Apr-21-2017, 05:09 AM |
|
|
Thread: Nested for loops with numbers
Post: RE: Nested for loops with numbers
(Apr-20-2017, 09:58 PM)volcano63 Wrote: (Apr-20-2017, 08:56 PM)smbx33 Wrote: .....
for copy in range(copies):
......
Since there's a standard module named copy, the variable with the same nam... |
|
smbx33 |
Homework |
7 |
5,867 |
Apr-21-2017, 12:37 AM |
|
|
Thread: Nested for loops with numbers
Post: RE: Nested for loops with numbers
Your code literally prints out the initial values entered, and that loops for the number of copies you want. To get the result you wish.... you have to make python count up from a number to the end nu... |
|
smbx33 |
Homework |
7 |
5,867 |
Apr-20-2017, 08:56 PM |
|
|
Thread: Python Exercise: Generate a two-dimensional array
Post: Python Exercise: Generate a two-dimensional array
I'm not a student anywhere, just doing python exercises to try and get better at coding through practice and sheer determination.
Currently, I am doing 100 python challenges that provide a challenge a... |
|
smbx33 |
Homework |
4 |
10,855 |
Apr-20-2017, 07:36 PM |
|
|
Thread: help in hoemwork
Post: RE: help in hoemwork
I recently just picked up python so I may not have the best answer...I have already solved it though.
My code has 2 functions. One function to count how many digits are in the number and another fun... |
|
smbx33 |
Homework |
15 |
7,674 |
Apr-17-2017, 02:43 AM |