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, 2019 in Python by Abdulsalam Elnaeem
153 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, 2019 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, 2019 in Python by Fata
• 1,050 points
400 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, 2019 in Python by Noel Deepak Palle
3,557 views
0 votes
1 answer

Command "python setup.py egg_info" failed with error code 1 in C:\Users\Nadeem\AppData\Local\Temp\

Hi@akhtar, I think you are using previous version ...READ MORE

answered May 4 in Python by MD
• 78,870 points
16,834 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
802 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,780 points
399 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,090 points
105 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, 2019 in Python by Junaid
188 views
0 votes
1 answer

What are the naming conventions for variables and data types in python?

There are certain rules that we have ...READ MORE

answered May 20, 2019 in Python by Mohammad
• 3,210 points
320 views