{"id":869,"date":"2015-08-27T12:13:37","date_gmt":"2015-08-27T12:13:37","guid":{"rendered":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/?p=869"},"modified":"2015-08-27T12:34:41","modified_gmt":"2015-08-27T12:34:41","slug":"python-input","status":"publish","type":"post","link":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/2015\/08\/27\/python-input\/","title":{"rendered":"Python &#8211; Input()"},"content":{"rendered":"<p>Python input() function returns a string to the assigned variable. This can cause us problems when we want to store integers or floats.<\/p>\n<p>We can use the int() function to convert the string to a integer or the float() function to convert it to a floating point. It is better to do this when you get the input or initialise the variable as you may forget later in the program.<\/p>\n<figure id=\"attachment_870\" aria-describedby=\"caption-attachment-870\" style=\"width: 523px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" data-attachment-id=\"870\" data-permalink=\"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/2015\/08\/27\/python-input\/inputint\/\" data-orig-file=\"https:\/\/blogs.glowscotland.org.uk\/nl\/public\/ColtnessHS-ComputingScience\/uploads\/sites\/12638\/2015\/08\/InputInt.png\" data-orig-size=\"523,178\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"InputInt\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/glow-prod-nl.s3.eu-west-1.amazonaws.com\/nl\/public\/ColtnessHS-ComputingScience\/uploads\/sites\/12638\/2015\/08\/InputInt-300x102.png?X-Amz-Content-Sha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%2BnB8Zq%2F10ZX8LxVYfbsrrb3sOIjUnkeGWx%2BGnkDGr8ob8q97FvPJkUuIhD6yV6mWhgS2torXPH75OzXvQQ%2BnaeWUsw%2F53U0wY6sQH%2F3ICg4EgsnIUFrGssXClLVfSKtn1E5GJuh2B%2FcbJCrcRnWrjkeQELUiV0SmyPFZmwJbC9A%2BbSTnjr44iOZ%2BG76CTewMV9y0y7DcAhmb9pgsLlO%2B0%2FcukeJ1RkEGFM8OUrVqm4qRraz1cxVzTrZcLk0%2BRxISOqwYWnZD43ngR90zc5%2BPV2g7Pzr%2BQJX3FljzUAU%2FeXGj5FuoG8t1auLS6wu0WPOY%2B8GHR4WyKUZuYI70g%3D&amp;X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=ASIAT7MQN47U6OK6IA7P%2F20260806%2Feu-west-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20260806T231958Z&amp;X-Amz-SignedHeaders=host&amp;X-Amz-Expires=900&amp;X-Amz-Signature=32134ac8c4d44af0ac6e2588e7f40ed3c09c68ab150cf7c879e21cdc99a1cdf7\" data-large-file=\"https:\/\/blogs.glowscotland.org.uk\/nl\/public\/ColtnessHS-ComputingScience\/uploads\/sites\/12638\/2015\/08\/InputInt.png\" class=\"wp-image-870 size-full\" src=\"https:\/\/blogs.glowscotland.org.uk\/nl\/public\/ColtnessHS-ComputingScience\/uploads\/sites\/12638\/2015\/08\/InputInt.png\" alt=\"InputInt\" width=\"523\" height=\"178\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/nl\/public\/ColtnessHS-ComputingScience\/uploads\/sites\/12638\/2015\/08\/InputInt.png 523w, https:\/\/glow-prod-nl.s3.eu-west-1.amazonaws.com\/nl\/public\/ColtnessHS-ComputingScience\/uploads\/sites\/12638\/2015\/08\/InputInt-150x51.png?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&amp;X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH8aCWV1LXdlc3QtMSJHMEUCIH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XPH75OzXvQQ%2BnaeWUsw%2F53U0wY6sQH%2F3ICg4EgsnIUFrGssXClLVfSKtn1E5GJuh2B%2FcbJCrcRnWrjkeQELUiV0SmyPFZmwJbC9A%2BbSTnjr44iOZ%2BG76CTewMV9y0y7DcAhmb9pgsLlO%2B0%2FcukeJ1RkEGFM8OUrVqm4qRraz1cxVzTrZcLk0%2BRxISOqwYWnZD43ngR90zc5%2BPV2g7Pzr%2BQJX3FljzUAU%2FeXGj5FuoG8t1auLS6wu0WPOY%2B8GHR4WyKUZuYI70g%3D&amp;X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=ASIAT7MQN47U6OK6IA7P%2F20260806%2Feu-west-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20260806T231958Z&amp;X-Amz-SignedHeaders=host&amp;X-Amz-Expires=900&amp;X-Amz-Signature=856b0970f86ec02e4742cba4848a4e90b01d7587edda3cfc32eb02511a9a1bec 150w, https:\/\/glow-prod-nl.s3.eu-west-1.amazonaws.com\/nl\/public\/ColtnessHS-ComputingScience\/uploads\/sites\/12638\/2015\/08\/InputInt-300x102.png?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&amp;X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH8aCWV1LXdlc3QtMSJHMEUCIHQZZpdPrDlV2UA7ZQLoXLqJJhztw1H1BYhNP017oHjbAiEA3%2FC8vui%2FhVFWUgzDKVjMiOF567KPGFrhe%2Bf3%2FiKWW5gquAUISBAFGgwyNzM1NzAxOTU0MzMiDIyKOiMLWYetbGy5lSqVBTjl%2B0UJexc8MyLWXv5kNSTCgiR0RKHy8k1S6wzeaKBE3ggTaqsZTsPKQ2QfPxni4VKn%2BpcwRwWWci4QfhKgmitsjvY8Loq9J8HcFjPOHcdaOUdOX%2B5teZh%2FVobvhO%2B1CgedquGLtMku54X09fzD7CC%2BWUMJ3l88HNMED%2BTYSBtMy5HXmxgWIKWijIiR0oBHRz8Epv%2BNufzN0BXNZGYcUgW5d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-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20260806T231958Z&amp;X-Amz-SignedHeaders=host&amp;X-Amz-Expires=900&amp;X-Amz-Signature=32134ac8c4d44af0ac6e2588e7f40ed3c09c68ab150cf7c879e21cdc99a1cdf7 300w\" sizes=\"(max-width: 523px) 100vw, 523px\" \/><figcaption id=\"caption-attachment-870\" class=\"wp-caption-text\">The first block of code shows Python returning a string. The second block of code uses a int() to return an Integer<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python input() function returns a string to the assigned variable. This can cause us problems when we want to store integers or floats. We can use the int() function to convert the string to a integer or the float() function to convert it to a floating point. It is better to do this when you &hellip;<\/p>\n","protected":false},"author":32,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17939,17932,17012,319,17013],"tags":[9849,21482,125715],"class_list":["post-869","post","type-post","status-publish","format-standard","hentry","category-coding","category-computational-constructs","category-national-4","category-oldhigher","category-national-5","tag-input","tag-int","tag-python"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/posts\/869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/users\/32"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/comments?post=869"}],"version-history":[{"count":3,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/posts\/869\/revisions"}],"predecessor-version":[{"id":873,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/posts\/869\/revisions\/873"}],"wp:attachment":[{"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/media?parent=869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/categories?post=869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/nl\/ColtnessHS-ComputingScience\/wp-json\/wp\/v2\/tags?post=869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}