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 4, 2019 in Python by Abdulsalam Elnaeem
1,191 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
2,472 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 20, 2019 in Python by Noel Deepak Palle
5,913 views
0 votes
1 answer
0 votes
3 answers
+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
6,408 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
2,343 views
0 votes
1 answer

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

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

answered Apr 18, 2018 in Python by Johnathon
• 9,090 points
859 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
2,229 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 21, 2019 in Python by Mohammad
• 3,230 points
2,081 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP