0% found this document useful (0 votes)
2 views2 pages

? Simple Python Setup Guide

This document is a simple guide for writing Python code using IDLE, covering installation, launching IDLE, creating a new file, writing code, saving the file, and running the code. It includes a sample program that demonstrates user input and output. The guide emphasizes the ease of modifying and rerunning code within the IDLE environment.

Uploaded by

singh.harjas2104
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

? Simple Python Setup Guide

This document is a simple guide for writing Python code using IDLE, covering installation, launching IDLE, creating a new file, writing code, saving the file, and running the code. It includes a sample program that demonstrates user input and output. The guide emphasizes the ease of modifying and rerunning code within the IDLE environment.

Uploaded by

singh.harjas2104
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

🐍 Simple Guide: Python Code with IDLE

IDLE is an excellent, no-fuss environment for writing your first Python programs.

💻 Step 1: Install Python


1. Go to the Official Website: Download Python

1️⃣Launch IDLE
1. Search: Go to your computer's search bar
2. Type: Type "IDLE" and open the application that appears.
3. Result: A window called the Python Shell will open.
4. It has the prompt >>>. This window is for quick testing, but we need a file to save
our code.

2️⃣Create a New File


1. Go to the Menu: In the IDLE Shell window, click on File in the top menu bar.
2. Select: Click New File (or press Ctrl+N / Cmd+N).
3. Result: A second, blank window will open. This is your editor window where you
will write your program.

3️⃣Write Your Code


In the new, blank editor window, type the following code:

Python
# A simple program to demonstrate input and output

print("--- Welcome to the IDLE Program ---")

# 1. Get the user's name


user_name = input("Please type your name: ")

# 2. Display a personalized greeting


print(f"Hello, {user_name}! I see you are using Python with IDLE.")

# 3. Perform a simple calculation


age_str = input("How old are you? ")
age = int(age_str)
next_year_age = age + 1

print(f"Next year, you will be {next_year_age} years old. Happy coding!")

4️⃣Save the File


1. Go to the Menu: In the editor window, click on File.
2. Select: Click Save As (or press Ctrl+Shift+S / Cmd+Shift+S).
3. Save: Choose a folder (like your Desktop or Documents) and save the file with a
meaningful name that ends in .py (e.g., my_idle_test.py).

5️⃣Run the Code


1. Go to the Menu: In the editor window, click on Run.
2. Select: Click Run Module (or press the F5 key).
3. Result: Your code will execute, and the output and prompts will appear in the
original IDLE Python Shell window.
4. Interact: Follow the prompts in the Shell window (e.g., type your name and age
when asked).

You can now modify the code in your editor window, save it (Ctrl+S), and press F5 again to
run the updated version!

You might also like