+ 1
Why cant i delete or undo in python
I am not able to delete mistakes i have made in my code when im using python on my laptop. For instance: If i put = instead of == and run my code it makes a bere bing! noise and when i notice my mistake and go back to add another = it wont allow it i would have to rewrite my entire code again
5 Respuestas
+ 2
Ray,
That makes no sense - Python is an interpreted language, as long as you save your source file and re-run, it should work fine.
What setup are you running on your laptop? Give as much info as possible.
+ 1
Ray, make sure your writing your code in the correct window - editor not the shell.
It sounds like your entering your code directly into the shell. Look at the window title, if it contains shell then there’s your issue.
You can always use a decent text editor to write your source instead. Simply save with a .py extension and run through a terminal/command prompt.
python pytest.py
+ 1
It seems i was indeed directly writing it on my shell, i have now downloaded Pycharm and i can delete stuff now. Thank you, DavX .
0
In Python, the ability to delete or undo actions may depend on the specific action and context in which it was performed.
For example, if you've defined a variable in Python, you can use the del keyword to delete that variable. Similarly, you can use the undo() function in some Python modules to undo actions in certain contexts. However, not all actions in Python can be undone or deleted, and the ability to do so is not a universal feature of the language.
Additionally, Python is an interpreted language, which means that code is executed immediately as it is written. Once a line of code has been executed, it may not be possible to "undo" or "delete" that action without modifying the code itself. Therefore, it's important to be careful and intentional when writing Python code, especially in situations where mistakes could have serious consequences.