Error in git and python command

+1 vote

first question :  when i write this code  

i=2
>>> while i<12 :
... print(i)

the results,,, as following:
  File "<stdin>", line 2
    print(i)
        ^
IndentationError: expected an indented block

second question:   bash: python: command not found

Jul 3 in Python by Abdulsalam Elnaeem
19 views

1 answer to this question.

+1 vote

The answer to your first problem is to use indentation. Indentation in python is usually a tab space or 4 blank spaces

Try this:

i=2 
>>> while i<12 : 
...     print(i)

where space is a tabspace:

i=2 
>>> while i<12 : 
... <tabspace>print(i)

The reason for the 2nd error is probably that Python path is not set. You have to do something like this:

$ PATH=$PATH:<path to Python folder/directory>
answered Jul 4 by Simran

i tried this but it does't work...

i=2 
>>> while i<12 : 
...     print(i)

See this:

If you don't add i=i+1, then it will go into infinite loop

Related Questions In Python

0 votes
1 answer
0 votes
0 answers

i am normalizing the data set iris in python and get the error ::TypeError: 'numpy.float64' object is not callable

for i in cnames:     print(i)     df_csv[i] = (df_csv[i] - ...READ MORE

6 days ago in Python by anonymous
12 views
+2 votes
2 answers

Error while printing hello world in python.

You must be trying this command in ...READ MORE

answered Mar 31, 2018 in Python by GandalfDwhite
• 1,320 points
63 views
0 votes
1 answer

How can I find out the index of an element from row and column in Python?

You probably want to use np.ravel_multi_index: [code] import numpy ...READ MORE

answered Apr 16, 2018 in Python by charlie_brown
• 7,710 points
62 views
0 votes
1 answer

what are "and" and "or" operators in Python?

AND - True if both the operands ...READ MORE

answered Apr 17, 2018 in Python by Johnathon
• 9,070 points
34 views
+1 vote
3 answers
0 votes
1 answer

Can someone explain the behaviour of increment and decrement operators in python

down voteaccepted ++ is not an operator. It is ...READ MORE

answered May 15, 2018 in Python by ariaholic
• 7,320 points
264 views
0 votes
1 answer

Create and open a file in Python

file = open('text.txt', 'w+) READ MORE

answered May 24, 2018 in Python by Nietzsche's daemon
• 4,260 points
42 views
0 votes
1 answer

Is there a way to list out in-built variables and functions of Python?

The in-built variables and functions are defined ...READ MORE

answered May 14 in Python by Junaid
26 views
0 votes
1 answer