## Tuesday, December 26, 2017

### Generate numbers from 1-5

Ther are many ways to print the first five integer numbers. I’m going to give you three different ways to make this happen:

• In the first method, we use “for” with “range”: “i” will begin empty and obtain different values every time “i” gets a new value it will be printed.
• For the second method, we again use “for” but the maximum range for “i” is 5 and every time we print “i” we add one.
• For the third example, we use “while” so while “j” is smaller than 6 print “j” and ad 1 to “j”

To make the separation on the different examples I used two different sorts of methods: In the first, there isn't really much to it, just print a bunch of underscores. But in my second I used this, “print("_" * 40) print("\n")”, at first I print 40 times “_” but I could have chosen any sort of symbol, after that I ad “print(“\n”)” wich only leaves a small sapace after each line

The code:

`````` # Generate numbers from 1-5
#Method 1. With For
for i in range(1, 6):
print(i)
#Method 2. With For (A variant)
print('_____________________________________________________\n')
for i in range(5): #var i takes the values from 0 to 4
print(i+1)
#Method 3. With While
print("_" * 40)
print("\n")
j=1
while (j<6 ):
print(j)
j =j+ 1     # j += 1  ``````

The terminal:
{"ft_lang_label":"__label__en","ft_lang_prob":0.8099247,"math_prob":0.886813,"size":1269,"snap":"2019-43-2019-47","text_gpt3_token_len":374,"char_repetition_ratio":0.14545454,"word_repetition_ratio":0.0,"special_character_ratio":0.3420016,"punctuation_ratio":0.09558824,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9682574,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-11-13T05:14:17Z\",\"WARC-Record-ID\":\"<urn:uuid:28747d01-b0a7-420e-b9d7-35ee8e2b5202>\",\"Content-Length\":\"54603\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c67e12aa-65c6-4a06-9300-b42dfea41f4e>\",\"WARC-Concurrent-To\":\"<urn:uuid:00d236a2-0972-4481-858b-23ca1be2a704>\",\"WARC-IP-Address\":\"172.217.12.243\",\"WARC-Target-URI\":\"https://www.magnitopic.com/2017/12/generate-numbers-from-1-5.html\",\"WARC-Payload-Digest\":\"sha1:3V47XMACJMGT2FODAMAVAZ2OYHIJGH2V\",\"WARC-Block-Digest\":\"sha1:PFG6VP7NMJISYLYJ2GCZUCHUFHY2KSUN\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-47/CC-MAIN-2019-47_segments_1573496665985.40_warc_CC-MAIN-20191113035916-20191113063916-00527.warc.gz\"}"}