What happens if you put a period at the end of a statement in python?
I don't know why but I've just never found a way around this problem. Show
Nội dung chính
My teacher wanted to get our class involved with coding and asked me to create a basic calculator in python. So I quickly typed up:
Simple stuff, I'll add subtraction and all that. However, being the grammar nazi I am, I cannot find a way to place a period at the end of that print command. I've solved it before. My first calculator didn't define functions, it just took the integers, then added them together and assigned them a variable and then printed them. I added periods by using %s and putting the variable at the end of the print command. Also, while if I try to print the option selected in a tkinter window for example with variable.get() I can't seem to put a period at the end either. The only thing I found only was putting + "." at the end or something along those lines. Can anyone help me? This is what I have written so far:
Now, this is my output:
I would like my output to be like the following: "The length of your name is 5." As you can imagine, by placing a comma next to the Integer length, I have an extra space I would like to take care of. I am new to Python so I do not really know how to solve this. Any help would be greatly appreciated. 0 points about 9 years So after pulling my hair out for 30 mins trying to figure out why Codecademy wouldnt accept my code even though it seemed to give the right answer, i noticed something… you need a period at the end of the printed sentence for the interpreter to pass you. This is my work and passing, correct code for anyone looking for it.
I hope this helps someone that might be frustrated for the same reason as me, because of something simple like a period at the end of that sentence. Answer 523ebd5980ff33a58c005cf0hmm, sometimes the judge program is just stupid. I made the same mistake and I just skip it. points about 9 years Answer 52405bbaf10c60fda4003288Bin there, done that. Only difference was about an hour of further trying. However I think you also learn as you try all the possible other things that might be the problem! points about 9 years Answer 52da6abc548c3552d5001cfebeen trying for long time so thanks a lot :) points over 8 years Answer 52e852908c1ccc5be6000891What’s up with my code? What am I missing?
points over 8 years Answer 52fa86b3631fe9c70d003c8dQUESTION: Why don’t you replace %s with %d for mpg? It’s already made for decimals.
result: This is a silver DeLorean with 88 MPG. points over 8 years Answer 52627374548c35b37d002b86points almost 9 years Answer 52cbff8980ff33dee3007d14It’s interesting. I had the same problem, but I HAD a period at the end of sentence. Second advice: DO NOT COPY SENTENCE FROM THE INSTRUCTION! When I rewrote a sentence by hands, it passed. points over 8 years What happens if you put a period at the end of a statement in Python?The period makes it a floating-point number. So writing "640." is equivalent to "640.0". The period allows for natural division with python: if you are dividing two integers, the result is simply an integer (and fractional remainder is truncated). What does a period mean in Python?In python, a period accesses methods (functions) and properties (data) of objects. How do you add a period to the end of a sentence in Python?Alexander Davison. You can "add" (concatenate) the period character to the end of the string. For example: "Harpreet is learning Python" + "!" # This code returns "Harpreet is learning Python!" How do you print a period at the end of a Python?Put quotation marks around it. print first_name, "was born on", month, day+',', year +'. ' What does the period do in Python?In python, a period accesses methods (functions) and properties (data) of objects. Parentheses are the only way to call functions, that I know of.
How do you add a period to the end of a sentence in Python?Alexander Davison. You can "add" (concatenate) the period character to the end of the string. For example: "Harpreet is learning Python" + "!" # This code returns "Harpreet is learning Python!"
Can a python variable have a period?With the exception of Cookie and Client scope variables, which must always be simple variable types, you cannot normally include periods in simple variable names.
How do you print a period at the end of a python?Put quotation marks around it. print first_name, "was born on", month, day+',', year +'. '
|