Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Confusing in [for loop] topic
Post: RE: Confusing in [for loop] topic

Thanks for your patient, I need this baby math calculation so much. **biggrin**
Sherine General Coding Help 11 3,495 Jul-31-2021, 02:37 PM
    Thread: Confusing in [for loop] topic
Post: RE: Confusing in [for loop] topic

(Jul-31-2021, 01:47 PM)ndc85430 Wrote: (Jul-31-2021, 01:45 PM)Sherine Wrote: "i in range (1, n)" the n = 5, so why the loop is not going until 4? it's only 3. How are you determining that the loop...
Sherine General Coding Help 11 3,495 Jul-31-2021, 02:17 PM
    Thread: Confusing in [for loop] topic
Post: RE: Confusing in [for loop] topic

(Jul-31-2021, 01:51 PM)deanhystad Wrote: From the documents: https://docs.python.org/3/library/stdtypes.html#range Quote:class range(start, stop[, step]) The arguments to the range constructor mus...
Sherine General Coding Help 11 3,495 Jul-31-2021, 02:15 PM
    Thread: Confusing in [for loop] topic
Post: RE: Confusing in [for loop] topic

(Jul-31-2021, 01:41 PM)deanhystad Wrote: You are using the wrong term. Your program has two loops. The outer loop ITERATES 4 times: (0, 1, 2, 3). The inner loop iterates 16 times: 4x(0, 1, 2, 3). ...
Sherine General Coding Help 11 3,495 Jul-31-2021, 02:11 PM
    Thread: Confusing in [for loop] topic
Post: RE: Confusing in [for loop] topic

(Jul-31-2021, 11:23 AM)ndc85430 Wrote: You're going to need to be clearer about what you mean. There are two loops there, not four. Trace through execution of the program by hand, writing down the v...
Sherine General Coding Help 11 3,495 Jul-31-2021, 01:46 PM
    Thread: Confusing in [for loop] topic
Post: Confusing in [for loop] topic

Hi, I read a book with this below question and answer. However I cant get the meaning of the explanation. x = 0 n = 5 for i in range(1, n): for j in range(1, n): if((i+j) == 2): ...
Sherine General Coding Help 11 3,495 Jul-31-2021, 11:17 AM
    Thread: Operator meaning explanation
Post: RE: Operator meaning explanation

(Jul-31-2021, 07:52 AM)ndc85430 Wrote: It's just the old way of allowing you to substitute the values of those variables for the placeholders (%s and %d) in the string, as the output shows. These da...
Sherine General Coding Help 3 2,022 Jul-31-2021, 11:05 AM
    Thread: Operator meaning explanation
Post: Operator meaning explanation

Hi, I have a question. name = "Giraffe" score = 80 print("%s result as %d" % (name, score))Output:Giraffe result as 80What meaning for the % sign place before (name, score)? Thanks
Sherine General Coding Help 3 2,022 Jul-31-2021, 07:48 AM
    Thread: Newbie to Python - input and branching issue
Post: RE: Newbie to Python - input and branching issue

(Jul-30-2021, 06:27 AM)ndc85430 Wrote: input returns a string, not an int. So, as the error says, it doesn't make sense to compare a string and a number. Use the int function to convert the value yo...
Sherine General Coding Help 3 2,228 Jul-30-2021, 06:52 AM
  Big Grin Thread: Newbie to Python - input and branching issue
Post: Newbie to Python - input and branching issue

Hi, I'm newbie to Python. I have a question on this coding, why I cant run this code? Can anyone guide me what's problem to this. Thanks age = input ("How old are you? ") height = input ("What...
Sherine General Coding Help 3 2,228 Jul-30-2021, 04:38 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020