Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":13559,"date":"2015-05-05T12:00:56","date_gmt":"2015-05-05T17:00:56","guid":{"rendered":"https:\/\/ismalga.withknown.com\/2015\/user-input-text-based-in-python-basic-mastery-28"},"modified":"2015-05-05T12:00:56","modified_gmt":"2015-05-05T17:00:56","slug":"user-input-text-based-in-python-basic-mastery-28","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2015\/2015\/user-input-text-based-in-python-basic-mastery-28\/","title":{"rendered":"User Input (text based) in Python (basic). Mastery 28."},"content":{"rendered":"
\n

<\/p>\n

<\/p>\n

Programs in Python are able to receive input coming from the user. The function able to do this is the input<\/em> function. When this function is called, the program stops and waits for the user to type something. The program continues when the user press return or enter. <\/span><\/p>\n

Example: <\/span><\/p>\n

\"\"<\/p>\n

<\/p>\n

<\/p>\n

After input(), the Python shell received the text that I wrote and that piece of text was assigned to the variable text, so when I print the text variable I am able to read the same text that I typed. <\/span><\/p>\n

Also, you can prompt to the user what to input, per example: <\/span><\/p>\n

\"\"<\/p>\n

<\/p>\n

<\/p>\n

If you want to see the input in a new line, use the sequence n at the end of the prompt. Example:<\/span><\/p>\n

\"\"<\/p>\n

<\/p>\n

Can you see the difference? In my opinion it looks nicer. <\/span><\/p>\n

<\/p>\n

<\/p>\n

If you expect the user to type a certain type, you can indicate that in your code. Example:<\/span><\/p>\n

\"\"\"\"<\/p>\n

<\/p>\n

<\/p>\n

But if I type something different than an integer I get an error message: <\/span><\/p>\n

\"\"<\/p>\n

<\/p>\n

<\/p>\n

So, this is basically how you handle basic input from the user. <\/span><\/p>\n

#Mastery<\/a>28<\/span><\/p>\n

\u00a0<\/p>\n

\u00a0<\/p>\n

\u00a0<\/p>\n

\u00a0<\/p>\n

\u00a0<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

\n

<\/p>\n

<\/p>\n

Normal
\n 0<\/p>\n

21<\/p>\n

false
\n false
\n false<\/p>\n

ES-MX
\n X-NONE
\n X-NONE<\/p>\n

<\/p>\n

<\/p>\n

\/* Style Definitions *\/
\n table.MsoNormalTable
\n\t{mso-style-name:”Tabla normal”;
\n\tmso-tstyle-rowband-size:0;
\n\tmso-tstyle-colband-size:0;
\n\tmso-style-noshow:yes;
\n\tmso-style-priority:99;
\n\tmso-style-parent:””;
\n\tmso-padding-alt:0cm 5.4pt 0cm 5.4pt;
\n\tmso-para-margin-top:0cm;
\n\tmso-para-margin-right:0cm;
\n\tmso-para-margin-bottom:8.0pt;
\n\tmso-para-margin-left:0cm;
\n\tline-height:107%;
\n\tmso-pagination:widow-orphan;
\n\tfont-size:11.0pt;
\n\tfont-family:”Calibri”,sans-serif;
\n\tmso-ascii-font-family:Calibri;
\n\tmso-ascii-theme-font:minor-latin;
\n\tmso-hansi-font-family:Calibri;
\n\tmso-hansi-theme-font:minor-latin;
\n\tmso-fareast-language:EN-US;}<\/p>\n

Programs in Python are able to receive input coming from the user. The function able to do this is the input<\/em> function. When this function is called, the program stops and waits for the user to type something. The program continues when the user press return or enter. <\/span><\/p>\n

Example: <\/span><\/p>\n<\/p>\n

<\/p>\n

<\/p>\n

Normal
\n 0<\/p>\n

21<\/p>\n

false
\n false
\n false<\/p>\n

ES-MX
\n X-NONE
\n X-NONE<\/p>\n

<\/p>\n

<\/p>\n

\/* Style Definitions *\/
\n table.MsoNormalTable
\n\t{mso-style-name:”Tabla normal”;
\n\tmso-tstyle-rowband-size:0;
\n\tmso-tstyle-colband-size:0;
\n\tmso-style-noshow:yes;
\n\tmso-style-priority:99;
\n\tmso-style-parent:””;
\n\tmso-padding-alt:0cm 5.4pt 0cm 5.4pt;
\n\tmso-para-margin-top:0cm;
\n\tmso-para-margin-right:0cm;
\n\tmso-para-margin-bottom:8.0pt;
\n\tmso-para-margin-left:0cm;
\n\tline-height:107%;
\n\tmso-pagination:widow-orphan;
\n\tfont-size:11.0pt;
\n\tfont-family:”Calibri”,sans-serif;
\n\tmso-ascii-font-family:Calibri;
\n\tmso-ascii-theme-font:minor-latin;
\n\tmso-hansi-font-family:Calibri;
\n\tmso-hansi-theme-font:minor-latin;
\n\tmso-fareast-language:EN-US;}<\/p>\n

After input(), the Python shell received the text that I wrote and that piece of text was assigned to the variable text, so when I print the text variable I am able to read the same text that I typed. <\/span><\/p>\n

Also, you can prompt to the user what to input, per example: <\/span><\/p>\n<\/p>\n

<\/p>\n

<\/p>\n

Normal
\n 0<\/p>\n

21<\/p>\n

false
\n false
\n false<\/p>\n

ES-MX
\n X-NONE
\n X-NONE<\/p>\n

<\/p>\n

<\/p>\n

\/* Style Definitions *\/
\n table.MsoNormalTable
\n\t{mso-style-name:”Tabla normal”;
\n\tmso-tstyle-rowband-size:0;
\n\tmso-tstyle-colband-size:0;
\n\tmso-style-noshow:yes;
\n\tmso-style-priority:99;
\n\tmso-style-parent:””;
\n\tmso-padding-alt:0cm 5.4pt 0cm 5.4pt;
\n\tmso-para-margin-top:0cm;
\n\tmso-para-margin-right:0cm;
\n\tmso-para-margin-bottom:8.0pt;
\n\tmso-para-margin-left:0cm;
\n\tline-height:107%;
\n\tmso-pagination:widow-orphan;
\n\tfont-size:11.0pt;
\n\tfont-family:”Calibri”,sans-serif;
\n\tmso-ascii-font-family:Calibri;
\n\tmso-ascii-theme-font:minor-latin;
\n\tmso-hansi-font-family:Calibri;
\n\tmso-hansi-theme-font:minor-latin;
\n\tmso-fareast-language:EN-US;}<\/p>\n

If you want to see the input in a new line, use the sequence n at the end of the prompt. Example:<\/span><\/p>\n<\/p>\n

<\/p>\n

<\/p>\n

Normal
\n 0<\/p>\n

21<\/p>\n

false
\n false
\n false<\/p>\n

ES-MX
\n X-NONE
\n X-NONE<\/p>\n

<\/p>\n

<\/p>\n

\/* Style Definitions *\/
\n table.MsoNormalTable
\n\t{mso-style-name:”Tabla normal”;
\n\tmso-tstyle-rowband-size:0;
\n\tmso-tstyle-colband-size:0;
\n\tmso-style-noshow:yes;
\n\tmso-style-priority:99;
\n\tmso-style-parent:””;
\n\tmso-padding-alt:0cm 5.4pt 0cm 5.4pt;
\n\tmso-para-margin-top:0cm;
\n\tmso-para-margin-right:0cm;
\n\tmso-para-margin-bottom:8.0pt;
\n\tmso-para-margin-left:0cm;
\n\tline-height:107%;
\n\tmso-pagination:widow-orphan;
\n\tfont-size:11.0pt;
\n\tfont-family:”Calibri”,sans-serif;
\n\tmso-ascii-font-family:Calibri;
\n\tmso-ascii-theme-font:minor-latin;
\n\tmso-hansi-font-family:Calibri;
\n\tmso-hansi-theme-font:minor-latin;
\n\tmso-fareast-language:EN-US;}<\/p>\n

Can you see the difference? In my opinion it looks nicer. <\/span><\/p>\n

<\/p>\n

<\/p>\n

Normal
\n 0<\/p>\n

21<\/p>\n

false
\n false
\n false<\/p>\n

ES-MX
\n X-NONE
\n X-NONE<\/p>\n

<\/p>\n

<\/p>\n

\/* Style Definitions *\/
\n table.MsoNormalTable
\n\t{mso-style-name:”Tabla normal”;
\n\tmso-tstyle-rowband-size:0;
\n\tmso-tstyle-colband-size:0;
\n\tmso-style-noshow:yes;
\n\tmso-style-priority:99;
\n\tmso-style-parent:””;
\n\tmso-padding-alt:0cm 5.4pt 0cm 5.4pt;
\n\tmso-para-margin-top:0cm;
\n\tmso-para-margin-right:0cm;
\n\tmso-para-margin-bottom:8.0pt;
\n\tmso-para-margin-left:0cm;
\n\tline-height:107%;
\n\tmso-pagination:widow-orphan;
\n\tfont-size:11.0pt;
\n\tfont-family:”Calibri”,sans-serif;
\n\tmso-ascii-font-family:Calibri;
\n\tmso-ascii-theme-font:minor-latin;
\n\tmso-hansi-font-family:Calibri;
\n\tmso-hansi-theme-font:minor-latin;
\n\tmso-fareast-language:EN-US;}<\/p>\n

If you expect the user to type a certain type, you can indicate that in your code. Example:<\/span><\/p>\n<\/p>\n

<\/p>\n

<\/p>\n

Normal
\n 0<\/p>\n

21<\/p>\n

false
\n false
\n false<\/p>\n

ES-MX
\n X-NONE
\n X-NONE<\/p>\n

<\/p>\n

<\/p>\n

\/* Style Definitions *\/
\n table.MsoNormalTable
\n\t{mso-style-name:”Tabla normal”;
\n\tmso-tstyle-rowband-size:0;
\n\tmso-tstyle-colband-size:0;
\n\tmso-style-noshow:yes;
\n\tmso-style-priority:99;
\n\tmso-style-parent:””;
\n\tmso-padding-alt:0cm 5.4pt 0cm 5.4pt;
\n\tmso-para-margin-top:0cm;
\n\tmso-para-margin-right:0cm;
\n\tmso-para-margin-bottom:8.0pt;
\n\tmso-para-margin-left:0cm;
\n\tline-height:107%;
\n\tmso-pagination:widow-orphan;
\n\tfont-size:11.0pt;
\n\tfont-family:”Calibri”,sans-serif;
\n\tmso-ascii-font-family:Calibri;
\n\tmso-ascii-theme-font:minor-latin;
\n\tmso-hansi-font-family:Calibri;
\n\tmso-hansi-theme-font:minor-latin;
\n\tmso-fareast-language:EN-US;}<\/p>\n

But if I type something different than an integer I get an error message: <\/span><\/p>\n<\/p>\n

<\/p>\n

<\/p>\n

Normal
\n 0<\/p>\n

21<\/p>\n

false
\n false
\n false<\/p>\n

ES-MX
\n X-NONE
\n X-NONE<\/p>\n

<\/p>\n

<\/p>\n

\/* Style Definitions *\/
\n table.MsoNormalTable
\n\t{mso-style-name:”Tabla normal”;
\n\tmso-tstyle-rowband-size:0;
\n\tmso-tstyle-colband-size:0;
\n\tmso-style-noshow:yes;
\n\tmso-style-priority:99;
\n\tmso-style-parent:””;
\n\tmso-padding-alt:0cm 5.4pt 0cm 5.4pt;
\n\tmso-para-margin-top:0cm;
\n\tmso-para-margin-right:0cm;
\n\tmso-para-margin-bottom:8.0pt;
\n\tmso-para-margin-left:0cm;
\n\tline-height:107%;
\n\tmso-pagination:widow-orphan;
\n\tfont-size:11.0pt;
\n\tfont-family:”Calibri”,sans-serif;
\n\tmso-ascii-font-family:Calibri;
\n\tmso-ascii-theme-font:minor-latin;
\n\tmso-hansi-font-family:Calibri;
\n\tmso-hansi-theme-font:minor-latin;
\n\tmso-fareast-language:EN-US;}<\/p>\n

So, this is basically how you handle basic input from the user. <\/span><\/p>\n

#Mastery<\/a>28<\/span><\/p>\n

 <\/p>\n

 <\/p>\n

 <\/p>\n

 <\/p>\n

 <\/p>\n<\/div>\n

Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":104,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3,25],"tags":[186,127,287],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13559"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/users\/104"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/comments?post=13559"}],"version-history":[{"count":2,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13559\/revisions"}],"predecessor-version":[{"id":17539,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13559\/revisions\/17539"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/media?parent=13559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/categories?post=13559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/tags?post=13559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}