Guided Exercise - Environment Setup & Initial Programming - Part-1 #25
akash-coded
started this conversation in
Tasks
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
1. Setting Up The Environment: Installing Python
Objective:
Ensure every learner has Python installed and can run a simple Python script.
Setup Guidelines:
Download Python:
python-3.x.x.exe).Install Python:
Check Installation:
python --versionand press 'Enter'.2. Writing Your First Python Script: Hello, World!
Objective:
Introduce learners to their first Python program.
Concepts Involved:
Step by Step Guided Instructions:
Create a New Text File:
hello.py. The.pyis very important as it tells the computer this is a Python script.Write Your Script:
hello.pyfile to open it.print("Hello, World!").Run Your Script:
hello.pyfile (If you saved it on the desktop, you'd use the commandcd desktop).python hello.pyand press 'Enter'.Rationale:
This exercise introduces learners to the process of writing and running a Python script. By seeing the message they wrote appear on the screen, they'll feel a sense of accomplishment and understand the basics of how scripts are executed.
3. Basic Data Types in Python
Objective:
Familiarize with basic data types like numbers and text.
Concepts Involved:
Step by Step Guided Instructions:
Open Python Interactive Shell:
pythonand press 'Enter'. This starts Python in interactive mode, which lets you type and run Python right there.Try Out Different Data Types:
5and press 'Enter'. You'll see5as the output."I am learning Python!"(with the quotes) and press 'Enter'. You'll see the messageI am learning Python!displayed.5 + 3and pressing 'Enter'. You should see8as the output.Understanding Variables:
a = 5and press 'Enter'. This stores the number5in a "box" nameda.b = 3and press 'Enter'.a + band pressing 'Enter'. You should see8as the output.Rationale:
This exercise helps learners understand that computers can store different types of information, like numbers and text. They also learn that this information can be stored in named "boxes" (variables) and used later.
4. Simple Operations with Text (Strings)
Objective:
Understand how to manipulate and play with text in Python.
Concepts Involved:
Step by Step Guided Instructions:
Open Python Interactive Shell:
pythonand press 'Enter'.Playing with Strings:
"Hello" + " World!"and press 'Enter'. You should seeHello World!as the output. This shows how we can combine (or "concatenate") two pieces of text.'Python ' * 3and press 'Enter'. You should seePython Python Pythonas the output. This shows how we can repeat a piece of text multiple times.Storing Strings in Variables:
greeting = "Hello, my name is "and press 'Enter'.name = "Alex"and press 'Enter'.greeting + nameand press 'Enter'. You should seeHello, my name is Alexas the output.Rationale:
This exercise teaches learners that text (or "strings") can be manipulated in various ways in Python, whether it's combining them, repeating them, or storing them in variables.
5. Making Decisions with Python (Basic Logic)
Objective:
Understand the basic decision-making ability of Python using simple conditions.
Concepts Involved:
Step by Step Guided Instructions:
Open Python Interactive Shell:
Understanding True and False:
5 > 3and press 'Enter'. You should seeTrueas the output, because 5 is indeed greater than 3.5 < 3and press 'Enter'. You should seeFalsebecause this statement is not correct.Using Conditions with Variables:
apple_price = 10and press 'Enter'.banana_price = 5and press 'Enter'.apple_price > banana_priceand press 'Enter'. You should seeTruebecause apples are more expensive in this scenario.Rationale:
This activity is crucial to demonstrate that computers can make decisions based on logic. The learners will see that Python can evaluate conditions and return a simple
TrueorFalseanswer, which forms the backbone of many advanced operations they'll learn later.Remember, the primary goal of these exercises is to gradually expose the learners to programming concepts without overwhelming them. By breaking down operations into simple steps and explaining each step in detail, they'll gain the confidence to tackle more complex tasks in the future.
6. Taking Inputs and Displaying Outputs
Objective:
Understand how to get input from the user and display a customized message.
Concepts Involved:
Step by Step Guided Instructions:
Open Python Interactive Shell:
Getting User Input:
name = input("What is your name? ")and press 'Enter'.namevariable.Displaying a Personalized Message:
print("Hello, " + name + "!")and press 'Enter'.Hello, [Your Name]!.Rationale:
Interactivity is a fundamental aspect of many programs. This exercise lets learners see how they can get information from users and use that information immediately in the program.
7. Simple Math with Python
Objective:
Learn how to perform basic arithmetic operations.
Concepts Involved:
Step by Step Guided Instructions:
Open Python Interactive Shell:
Trying Out Basic Arithmetic:
5 + 3and press 'Enter'. You should see8.10 - 3and press 'Enter'. You should see7.4 * 4and press 'Enter'. You should see16.8 / 2and press 'Enter'. You should see4.0.Using Variables for Arithmetic:
length = 10and press 'Enter'.breadth = 5and press 'Enter'.area = length * breadthand press 'Enter'.print(area)and press 'Enter'. You should see50.Rationale:
Basic arithmetic operations form the core of many complex calculations in programming. By playing with numbers directly and then using variables, learners get a feel of how Python can act as a powerful calculator.
8. Fun with Repetition: Introduction to Loops
Objective:
Learn the concept of repetition in Python using a simple loop.
Concepts Involved:
forloop.Step by Step Guided Instructions:
Open Python Interactive Shell:
Repeating an Action:
for i in range(5):and press 'Enter'. (Notice the colon at the end!)print("I love Python!")and press 'Enter'.Rationale:
Repetition is a crucial concept in programming, enabling tasks to be repeated multiple times without rewriting the code each time. This simple loop introduction lays the foundation for more complex iterations and loop-based logic they'll encounter later.
Beta Was this translation helpful? Give feedback.
All reactions