In [6]: %run -i sqrt_num_list.py File ~\sqrt_num_list.py:1 Python 3.12.3 (tags/v3.12.3:f6650f9, Apr 9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32 ^SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integersI am not understanding this error please explain. I used IDLE to code input and the saved file is in the current working directory.
What is the use of "*=" operator while doing the exercise question ???
In [8]: for num is numbers: ...: print("sqrt of",num,"is",num**0.5) File "<ipython-input-8-d53f5a6e8ccb>", line 1 for num is numbers: ^SyntaxError: invalid syntaxAccording to instruction , when i press enter after writing for command it shows error. I am using windows OS. Plz help with this.
%run -i C:\Users\sai pujitha\sqrt.py----------------------------------------------------------------OSError Traceback (most recent call last)c:\users\sai pujitha\appdata\local\programs\python\python39\lib\site-packages\IPython\core\magics\execution.py in run(self, parameter_s, runner, file_finder) 702 fpath = arg_lst[0]--> 703 filename = file_finder(fpath) 704 except IndexError:
Respected sir/mam, in the 2 question we got to know how to find the factorial of the numbers from 1 to 20 . could you please tell me how to find the factorial of a particular number say factorial of 10 i.e 10! ?
Can you please explain this code?y=1for x in range(1,21): y *= xprint(y)
Where to save the file, if i am using window?
how to open text editor simulataneously in ipython
In windows, range(1,5) not showing expected output [1,2,3,4,5], Why?
Can we use range() function for string data also. If yes, How?
In [9]: %run -i sqrt_num_list.py File "C:\Users\gargr\sqrt_num_list.py", line 2 for num in numbers ^SyntaxError: invalid syntaxthe following is the notepad code:numbers=[4,9,16,25,36]for num in numbers print("sqrt of", num, "is", num**0.5)print("This is outside for-loop")
What is the purpose of range()?
Hello! I am using python 3.6.8 and while doing the tutorial i have encountered an error ... I created the for loop statement in the notepad++ as instructed and saved it as sqrt_num_list.py but when i run it in the ipython console it says ERROR:root:File`'sqrt_num-list.py'` not found.I have kept my file in the path as entered in the environment variable for my user. Can you please help me to solve my problem because it is causing me to delay my learning . Thank you !!
in the tutorial there is a question what will be the output of range(1,5)? The answer for this is mentioned in it is [1,2,3,4]but in the interpreter if we give this the output will be range(1,5). Please explain what happens actually when range() function invokes.How this works in for loop
range(20) when entered in ipython console will give you output as same range(20) again. To see the actual numbers type:list(range(20)) it will typecast to list and output will be [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
27062 visits
Outline:For loop syntax Example to use For loop Indentation in for loop Create blocks in python using for Iterate over a list using for loop How to get out of the block use of Range() function Range function in for loop How to use Python interpreter IPython interpreter to specify blocks
For loop syntax Example to use For loop Indentation in for loop Create blocks in python using for Iterate over a list using for loop How to get out of the block use of Range() function Range function in for loop How to use Python interpreter IPython interpreter to specify blocks
Show video info
Pre-requisite