Apr-27-2017, 04:26 AM
Apr-27-2017, 04:32 AM
Please show us an attempt so we can try to assist you.
Apr-27-2017, 04:43 AM
This is my attempt :
for k in range(1,101,2): print(K)But it shows following error
Error:Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> for k in range(1,101,2):
print(K)
SyntaxError: expected an indented block
Apr-27-2017, 04:49 AM
Error:SyntaxError: expected an indented block
place 4 spaces in front of print(k)That makes an indented block
Apr-27-2017, 04:49 AM
As the error says you need to have the second line indented. What tutorial are you following?
for k in range(1,101,2): print(k)
Apr-27-2017, 05:38 AM
As far as odd numbers go, do you know how to determine whether a number is odd (mathematically, not necessarily in Python)?
Apr-27-2017, 07:30 AM
(Apr-27-2017, 04:43 AM)RandoomDude Wrote: [ -> ]This is my attempt :Except for the indentation error, you will get NameError after indentation is ok. In print() you are using upper K
for k in range(1,101,2): print(K)But it shows following error
Error:Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> for k in range(1,101,2): print(K) SyntaxError: expected an indented block
Apr-27-2017, 08:52 AM
(Apr-27-2017, 07:30 AM)wavic Wrote: [ -> ]Except for the indentation error, you will get NameError after indentation is ok. In print() you are using upper KWavic,you are the man,i just checked my code and found that i used upper K in between () of the print statement.
Thanks