Python Tutorials - Your Guide to Getting Started
Introduction to Python Tutorials for Beginners and New Learners to Coding
If you have decided to start learning Python, we have a series of tutorials that we have curated from our experiences of teaching coding to new and young learners.
We will support your learning journey through weekly QnA and support you in your coding journey through a variety of different methods.
Python Tutorials - The Basics
Coding Challenges - Practice for List and Loops
This is your first look at PyCharm | Running your first program
Go ahead and get started with your first program in IDE. Understand the basic framework of the IDE, how to organize your code files, create a new Python file, write the code, and run the program. You will then look at the output console and how to read it.
Python Code to Generate a 6-Digit OTP | import your first python module - random
This video will make you take a leap and get into the thick of coding by you importing a module and calling the random function to be able to generate a 6 Digits OTP. Its a little bit long, as we have covered a few things around learning. But if you are the type that wants to only code, you can use the following timing information to jump into the particular section.
Python Code to use variables and basic Math operators like Addition, Subtraction, Multiplication and Division
This video starts with a fun puzzle that guesses the remainder of a few math operations. We then go back to our OTP program to write the code to simulate this Quiz and test that it works with all kind of numbers.
Python Code to play Lucky 50; a funfair inspired game | Take action based on conditions, using If, elif, else
In this tutorial you simulate the 7 UP, 7 DOWN Game, where based on the number generated the code prints the appropriate message. This introduces you to the fundamental conditional coding in any programming language – the if – else condition.
What is the Big Deal about different Types of Data? Python Code to see Int and Str and convert str to int
This tutorial is a must watch to understand on how there are different types of data that are used commonly in real world and how they are used in the world of programming. You will then see how just the humble integer and string can cause so much havoc to the Interpreter.
Additonally, You will get comfortable with looking at many different kind of errors, and how to handle them when you come across them.
Code Challenge - Python code to play the Game Rock, Paper, Scissors
This is your opportunity to start Coding with us as you enjoy a popular game amongst kids – Rock, Paper, Scissors. You will Code that will utilise the function choice of random module. You will then be using if:elif:else condition to find out who is the Winner.
Coding Challenges - The Basics
1 – Take an input from user between 1900 and 2100
2 – Only if the number is in this range, check if this is a Leap Year
3 – If Leap Year, print – “Yeah!! you have an extra day – code some more”
4 – If not a Leap Year, print – “year is short, don’t procrastinate :))”
1 – Accept 3 values from users
2 – Print which value is biggest (max) and which is smallest (min)
1 – Code as following
now = 10
then = 11
You have code to swap the value of the variables in ‘now’ with ‘then’.
When you print, values should be
then = 10
now = 11
1 – Import the math module
2 – Use 5 functions of your choice and get comfortable using functions.
Python Tutorials | Data Types List, Strings | Use and application
Python code to play Lucky 50 10 times | Using the 'while' loop and 'for' loop for the problem statement
We will now do a Code Challenge to keep generating a number until we get the number 50. This requires us to use a loop that can be run based on a condition. You are therefore introduced to the ‘while’ loop. You will also use another loop ignorer to run this 10 times.
Coding Challenges - Practice for List and Loops
You had earlier done a program where you took 3 numbers and found out which is max and min.
Now, you have to do the next version of the program, as we can see you enjoying a bit of head scratching :))
1 – Create a list of random numbers (15 numbers)
2 – Find out which is the maximum and which is minimum in the list by writing your own code logic
3 – Print the max and min of the list
Important NOTE: You cannot use the max() / min() or any other ready functions
In this exercise, you will learn and apply several different ways to work with list, like creating a list and populating them with x number of elements, and then shuffling the elements.
# Step 1 – Generate a list of 20 elements with value 1900
# HINT – Use the * operator with a list to generate multiple elements
# Step 2 – Update the list elements to hold 1900 – 1919 as the values
# Step 3 – Shuffle the list elements such that they are randomly spread
# Step 4
# 4a) Find the index for the value 1900 using the function fron list data type to locate an index
# 4b) Find the index for the index for 1900 by coding yourself without using the available function
# The Mumbai Airport flight schedule display for flight number and departure time
# has gone berserk after a recent software maintenance
# The list for timing appears to be reversed in order, the timings all appearing WRONG
# PART A
# The main software team is on leave and you are the only one around to fix this.
# Can you please do this at the earliest, as this is causing chaos for the passengers
# You have a very short time to fix this
# The display is expected to show following line per flight
# Flight ASA100 is scheduled to depart at 8:00
# Flight AI124 is scheduled depart at 8:05
# …
# Flight UP777 is scheduled to depart at 12:50
# Flight 6Z555 is scheduled to depart at 13:50
# Part B
# Everyone is pleased that you took a very short time to fix the Display
# Your Team Lead has now asked you to write a code to create a 2-D List such that
# The flight number and schedule is in the same list to avoid any confusion
# Can you write the code that will create a single 2D list from the 2 lists?
# Expected outcome for flight schedule in 2D List
# [[‘ASA100’, ‘8:00’], [‘AI124’, ‘8:05’], [‘6Z2166’, ‘8:40’], [‘VS8766’, ‘9:05’], [‘G82315’, ‘9:50’], [‘6E282′, ’10:10’], [‘AI123′, ’11:15’], [‘SA422′, ’12:10’], [‘UP777′, ’12:50’], [‘6Z555′, ’13:50’]]
# Part C
# Now list down the display from the new 2D List that you have created
Python Code Challenge to list down all sub-strings | You are going to be using a nested for loop
This tutorial helps you get started in applying what you have learnt so far by doing a slightly complex logic on listing down all of the sub-strings. Sub-strings are basically continuous sequence of characters in a given string. The problem makes you use many things that you have learned so far, and tests you by taking one notch up as you will need to use nested loops.
Python Code Challenge to format a given text message in Standard English format | You are going to be using String functions like capitalize, startswith, replace
This tutorial Challenges you to test yourself by converting a strangely formatted text message into proper English format. You will try out the string functions and see how to produce a desirable outcome. You are going to be using String functions like capitalise, startswith, replace.
Coding Challenges - Practice for Strings
You all must be familiar with importance of passwords to secure yourself online. One of the most important ways to ensure that your online accounts are safe and secure is to protect your passwords. Password security starts with creating a strong password.
A strong password is:
- At least 12 characters long
- A combination of uppercase letters, lowercase letters, numbers, and symbols.
Write a function that will accept a password
returns:
0 if the password is Weak
1 if the password is Strong
def check_password_strength(password):
<TO DO>
return 1 or 0
Test Cases:
Weak
Password
123456789
azertyuiopqwqw
1111111111111
Googledummy123
googledummy@123
GoogleDummy123
Strong
google$dummY@123
azerty#Quiopqwqw&777
GauE#w73PJQ1
B&P9Hb7sRP&u
za9sQ%FH48Egc$
K3Q1*wmf7Tg7ss
Write a function that takes a input word (called seed word) and generates a strong password
def gen_strong_password(seed_word):
return a_strong_password
Example:
my_strong_password = gen_strong_password(theworldisround)
my_strong_password will be any combination around this,
like the&Worldis365@round or The@Wor#Ldi123Sro456Und
Write a function that will take the seed word and the strong password and try to guess the password. It will return the number of attempts it took to guess the strong password or say “You are SUPER PASSWORD”
def guess_my_password(seed_word, strong_password):
return <no of attempts>
OR
return “You sre SUPER PASSWORD”