- #10,186
BillTre
Science Advisor
Gold Member
- 2,487
- 9,720
( This was re Python code that a positive integer n and ouputs the string 123..n )Ibix said:I wouldn't call that recursion, but yes it should work.
n=int(input)
for i in range(1,n+1):
print(i, end = "")
The wind is not letting up. Here is what a Google search shows:dlgoff said:Dang. Wind chill is -25 degrees F here right now.
Sorry to hear. Are you required to go out? Do you have enough provisions to last you through it?dlgoff said:The wind is not letting up. Here is what a Google search shows:
Dangerously cold wind chills from 25 below zero to 40
below zero.
Because range(a,b) gives a, a+1,..., b-1, consistent with range(b) giving 0, 1,..., b-1.WWGD said:(not sure why we're using n+1 rather than n)
This lets you do it as a one-liner, assuming you've read in n already:WWGD said:There was another way of adjoining through ("".join(i,j) ), which does output the string 'ij' , but I would have had to iterate with a base case. Will try it some other time.
print("".join([str(i+1) for i in range(n)]))
__name__ stores the name of the python module, and if it is __main__ then it's the entry file - i.e., the user ran python thismodule.py, rather than the module being brought in via an import statement. If you put any "script" style code (rather than class/variable/function definitions) in that if statement then you can include the module via import in another program, and all your classes etc are available to that program without whatever script you wrote getting executed. The primary use I've made of this is to write some working demo code inside a library:WWGD said:Though nots ure why I was told to include:
if __name__ == '__main__':
class MyClass:
def whatever(self):
return "whatever"
if __name__ == "__main__":
print("Demo of MyClass' whatever() method:")
c = MyClass()
print(c.whatever())
I'm retired, so will be staying inside. I will only go out to drive to my mailbox. I've got enough to eat for a while. Thanks.WWGD said:Sorry to hear. Are you required to go out? Do you have enough provisions to last you through it?
Just in case, the US Soccer team may be flying over , something may happen to the flight. In case you get too hungry. ;).dlgoff said:I'm retired, so will be staying inside. I will only go out to drive to my mailbox. I've got enough to eat for a while. Thanks.
WWGD said:Still unclear why/how Quic/Http3 with UDP is preferred to Https with TCP/IP . Of the two, only Https with Tcp/Ip has ways of verifying whether packets arrived.
It's 17 degrees F and the wind chill is still -25 degrees F and every thing is ice covered. I hate winter.dlgoff said:Dang. Wind chill is -25 degrees F here right now.
I think of it this way: it's the season to eat rich, heavy foods that would knock you out if you ate them in winter.dlgoff said:It's 17 degrees F and the wind chill is still -25 degrees F and every thing is ice covered. I hate winter.
I expected that EVs don't perform well in weather below freezing.The 44-year-old radio presenter, from Lynchburg in eastern Virginia, told Insider it was 19 degrees (minus 7 C) when he plugged his Tesla S into a supercharger on Friday as his battery was down to 40%.
"Ya think?"Astronuc said:I expected that EVs don't perform well in weather below freezing.
Every thing is covered with a layer of ice now.dlgoff said:starting to get a little sleet now.
You would be welcome in my neighborhood, it's known as "Shake-'N'-Bake" land. (AKA Southern California)dlgoff said:...every thing is ice covered. I hate winter.
Mine are lying in bed, along with the rest of me, if that helps.WWGD said:Still looking for an example of someone who's hips do lie.
Um...WWGD said:I found out I had missed one day of the week during two of my classes. I thought back then they were MWF classes, but they actually were MTWTh classes.
Ah, yes, MTF vs MTThF.berkeman said:Um...
WWGD said:On a related note, I found out I had missed one day of the week during two of my classes. I thought back then they were MWF classes, but they actually were MTWTh classes.
berkeman said:Um.
And I see the reason remains.WWGD said:Ah, yes, MTF vs MTThF.
I don't see it. I know it may be unusual , but we did have some MTF classes, rather than MWF , if that's what you mean.Tom.G said:And I see the reason remains.
IMHO he's QQ about your AAWWGD said:if that's what you mean.
Something about the World Wrestling Federation. Great school! But, no, its about the days of the week ;).Rive said:IMHO he's QQ about your AA
Ps.: I too wonder what MTF, MWF, MTWTh, MTThF might be...
Just to let you guys know, the district just got my water going again.dlgoff said:What's next? Now my water district is having a water outage.