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
28 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

What to do when I get and error saying python not recognized as internal or external command?

You need to set up the path ...READ MORE

answered May 28 in Python by Fata
• 1,040 points
47 views
0 votes
1 answer

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

TRY THIS   #Nomalisation for i in names:     print(i)   ...READ MORE

answered Aug 19 in Python by Noel Deepak Palle
464 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
119 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,720 points
98 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,080 points
51 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,340 points
447 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
63 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
44 views
0 votes
1 answer