#16 Python Tutorial for Beginners | Working with PyCharm | Run | Debug | Trace | py file

#16 Python Tutorial for Beginners | Working with PyCharm | Run | Debug | Trace | py file

Introduction to Python

In this video, the instructor introduces Python and explains how to write code in a file instead of an interactive console.

Writing Code in a File

  • To write multiple lines of code, create a file with the extension ".py".
  • Save the file and store it anywhere you want.
  • To run the code, click on "Run Module" or use the command prompt and navigate to the folder where your file is saved.
  • Use the command "python" followed by the name of your file to run it.

Starting with Simple Code

  • Start with simple code like printing "Hello".
  • Before running your code, make sure to save it using "Control + S".
  • Navigate to where you want to save your file and give it a name with the extension ".py".
  • Run your code using either "Run Module" or through the command prompt.

Importance of Learning Basics First

  • It's important to learn the basics before jumping into big projects.
  • Working step by step will help prevent getting stuck later on.
  • Don't rush into big projects without first mastering basic concepts.

Writing and Running Python Code in PyCharm

In this section, the speaker explains how to write and run Python code using PyCharm.

Getting Started with PyCharm

  • To get started with PyCharm, click on "Create New Project" and enter a project name.
  • Once you have created a project, you can create a new file by right-clicking and selecting "New File".
  • When creating a new file, make sure to give it the extension ".py" so that it is recognized as a Python file.

Writing Code in PyCharm

  • To write code in PyCharm, simply open the file you want to work on and start typing.
  • You can change the font size or color theme by going to "File" > "Settings" > "Editor".
  • To run your code, click on the "Run" button and select "Run 'filename.py'".
  • You can also run your code by right-clicking on the file and selecting "Run 'filename.py'".

Debugging Code in PyCharm

  • One advantage of using an IDE like PyCharm is that you can debug your code.
  • To debug your code, click on the "Debug" button instead of the "Run" button.
  • This will allow you to trace what is happening in your code and see how values are changing.

Debugging in PyCharm

In this section, the speaker explains how to debug code in PyCharm and the importance of tracing.

Setting a Breakpoint

  • To debug code in PyCharm, set a breakpoint by clicking on the line number and then clicking on "debug".
  • Alternatively, you can press F8 to move to the next line.
  • The variable section shows the type and value of variables at each step.

Importance of Tracing

  • Tracing is important when working on large projects with many lines of code.
  • To trace, put a breakpoint on a specific line and use F8 to move through each line.
  • This allows you to identify bugs and understand what is happening at each step.

Conclusion

The speaker concludes by discussing future topics that will be covered in the series.

  • The series will focus more on using PyCharm for coding.
  • However, there may still be some videos that use other IDEs or languages.
  • Viewers are encouraged to ask questions and share the series with friends.
Video description

Check out our courses: AI Powered DevOps with AWS - Live Course :- https://go.telusko.com/AIDevOps-AWS Coupon: TELUSKO10 (10% Discount) Complete Java Developer Course Batch-4: https://go.telusko.com/Complete4 Coupon: TELUSKO10 (10% Discount) Master Java Spring Development : https://go.telusko.com/masterjava Coupon: TELUSKO20 (20% Discount) Udemy Courses: Spring: https://go.telusko.com/udemyteluskospring Java:- https://go.telusko.com/udemyteluskojava Java Spring:- https://go.telusko.com/Udemyjavaspring Java For Programmers:- https://go.telusko.com/javaProgrammers Python : https://go.telusko.com/udemyteluskopython Git : https://go.telusko.com/udemyteluskogit Docker : https://go.telusko.com/udemyteluskodocker For More Queries WhatsApp or Call on : +919008963671 website : https://courses.telusko.com/ Instagram : https://www.instagram.com/navinreddyofficial/ Linkedin : https://in.linkedin.com/in/navinreddy20 TELUSKO Android App : https://bit.ly/TeluskoApp In this lecture we are discussing: #1 how to save file instead of running in idle console #2 how to run the file in terminal or command prompt #3 use of pychram to run the code #4 how to debug the code in pycharm -- idle is interactive console -- when you work on project you are not using console -- you need to write on a file #1 how to save file instead of running in idle console -- open idle -- write the code -- save the file e.g main.py , navin.py -- for python we have file extension with .py -- you can save the file anywhere #2 how to run the file in terminal or command prompt or in idle using run button a) using run button in idle -- before runnig the code you need to save -- then you can run the code -- using run button which are available in idle b) using terminal or command prompt -- navigate to folder where you have saved the file -- in terminal or command prompt write python file name e.g python main.py e.g python navin.py ---------- print("Hello") x=5 y=6 z=x+y print(z) save the file run the file --------------- #3 use of pychram to run the code -- you can use ide like pycharm: -- first time -- click on create new project -- give the name of the project -- then click on create click on create new file give name MyCode write the code inside the file ------------ x=5 y=6 z=x+y print(z) -------------- save the file go to run directly in pycharm click on run #4 how to debug the code in pycharm you can debug the code add breakpoint go to run click on debug click on step over or f8 key you can see the value of x,y,z in debug mode Github :- https://github.com/navinreddy20/Python- Java:- https://bit.ly/JavaUdemyTelusko Spring:- https://bit.ly/SpringUdemyTelusko More Learning : Java :- https://bit.ly/3x6rr0N Python :- https://bit.ly/3GRc7JX Django :- https://bit.ly/3MmoJK6 JavaScript :- https://bit.ly/3tiAlHo Node JS :- https://bit.ly/3GT4liq Rest Api :-https://bit.ly/3MjhZwt Servlet :- https://bit.ly/3Q7eA7k Spring Framework :- https://bit.ly/3xi7buh Design Patterns in Java :- https://bit.ly/3MocXiq Docker :- https://bit.ly/3xjWzLA Blockchain Tutorial :- https://bit.ly/3NSbOkc Corda Tutorial:- https://bit.ly/3thbUKa Hyperledger Fabric :- https://bit.ly/38RZCRB NoSQL Tutorial :- https://bit.ly/3aJpRuc Mysql Tutorial :- https://bit.ly/3thpr4L Data Structures using Java :- https://bit.ly/3MuJa7S Git Tutorial :- https://bit.ly/3NXyCPu Donation: PayPal Id : navinreddy20 https://www.telusko.com