INTERACTIVE PROGRAMMING IN PYTHON

 

~Sandhiya and Kayalvizhi

We learned “An Introduction to Interactive Programming in Python (Part-1 and Part-2) Online course in Coursera.

CodeSkulptor is an interactive, web-based Python programming environment that allows Python code to be run in a web browser.

These are the game we learnt in the coursera course,

  • Rock Paper Scissors
  • Guess the number
  • Ping pong
  • Stop watch
  • Blackjack
  • Memory game
  • Spaceship/Asteriod

We are trying to run the Codeskulptor python in our local system (Create executable file). In codeskulptor we have a save options to download our code.

We used following steps to converting the python files into exe.file in local system.

These are the API tried for Simplegui to run the code for local system.

  • SimpleGUITk

SimpleGUITk is a wrapper for the CodeSkulptor SimpleGUI API using TkInter. CodeSkulptor is a browser-based Python interpreter used in the online course “An Introduction to Interactive Programming in Python”.

  • Create Pyinstaller using to EXE: https://datatofish.com/executable-pyinstaller/
  • Install pip install SimpleGUITk
  • Change the import simplegui to import simpleguitk
  • Able to run the codeskulptor file in our local and create the .exe file also, but not able to run and create exe file for the images having file like blackjack and spaceship game.
  • Simplequi

Same thing we did for simplequi also, not able to create the blackjack and spaceship game.

  • Download the images and set a path to the image in the spaceship python code. Not able to get the image file.

Solution-1(Windows)

  • Install SimpleGUICS2Pygame

https://pypi.org/project/SimpleGUICS2Pygame/

  • Replace the import simplegui to

try:

import simplegui

except ImportError:

import SimpleGUICS2Pygame.simpleguics2pygame as simplegui

  • Convert .py files to .exe file

Install pysimplegui-exemaker

https://pypi.org/project/pysimplegui-exemaker/

  • Run the Pysimplegui-exemaker– open the command prompt and paste

python -m pysimplegui-exemaker.pysimplegui-exemaker

The pop up showed liked that, browse your code in source python file and click Make EXE.

 

 

 

 

 

 

Edible Weed Walk at Evergreen with Nina Sengupta

As part of the ‘Becoming and Being a Shifu (Master)’ program a program to develop skills (programming and VLSI), competencies (using skills to create healthy workplaces and environment) and inner capacity (universal values) the participants are exploring some activities of Auroville. This short report is about the visit to Evergeen where we went for a ‘weed walk’ with Dr. Nina Sengupta who is an ecologist and an Aurovilian.

At C3STREAM Land Designs we learn, grow, work and teach and 5 of us went along with 7 Shifians to learn and grow.

Our visit started with the introduction of the book written by Dr. Nina – ‘Edible Weeds and Naturally Growing Plants in Auroville’. It was interesting to see that the book cover was hand-made, made from eco-friendly material. The treasure started unfolding with every plant she included in the book. Every book has two copies – one with precisely scaled plants in color and the other one with outlines which can be used as hands-on, color it to get closer to these plants.

We walked through the book one plant at a time and learned about the properties of edible weeds like Antigonan Leptopus. The first myth that was demystified while having this walk is not all weeds are non-edible, and many of them can be used not only for medicinal purposes but are a good source of nutrients for humans too. Generally, we ignore these weeds considering everything as another type of grass but they are all around us and we only have to recognize them and learn which parts of that particular weed are edible.

Once we recognize which parts are edible, then comes the next important thing – the appropriate quantity and frequency of weed to eat, the process of cooking if required. For example, some weeds can be used well after blanching them, while other weeds can be eaten raw.

The weed-walk was getting more and more interesting as we got to see and taste the different weeds. While we were able to observe weeds, on the other hand, we got closer to nature, and that also allowed us to express our learning. There are two major varieties of weeds – wild and cultivated weeds. Some species originated late, which are not mentioned in the Ayurveda. We need to constantly keep learning to know more about these weeds and start looking at these weeds from different perspectives whenever we see them around us.

The walk ended with the tasty herbal tea made by Archana and with the interactive conversation about edible-weeds, experiences of Nina as an ecologist, and Auroville in general. Thanks to Nina, Archana, and the Evergreen team for this wonderful opportunity.

~Team Shifu with C3STREAMLand members

 

 

About Shell basics, Grep and Find commands

~Ganesh, Ranjith

Shell – also called as command interpreter

Interactive use: reads command lines from a terminal

Shell script: When we put command lines into a file, that file is called a shell script or shell program.

 

Broad types of shell – bash and csh

C shell (csh):

Especially good for working on a terminal

 

Bourne Shell (sh):

Probably used more often for shell programming.

Newer version “Bourne-again” shell (bash) combines handy interactive C shell−like features with Bourne shell syntax, and is preferred choice.

 

which :

It takes one or more arguments. For each of its arguments it prints to stdout the full path of the executables that would have been executed when this argument had been entered at the shell prompt. It does this by searching for an executable or script in the directories listed in the environment variable PATH

e.g.

which ls

/usr/bin/ls

 

To see which shell I am running…

echo $SHELL

/bin/bash  – tells which shell we are using (bash here).

 

env :

env is used to print environment variables.

Most environment variables are in capital

 

 

 

env

SHELL=/bin/bash

WSL_DISTRO_NAME=Ubuntu-20.04

NAME=DESKTOP-HABEOE2

PWD=/mnt/e/unix

LOGNAME=ganesh

MOTD_SHOWN=update-motd

HOME=/home/ganesh

LANG=C.UTF-8

 

HOME:

Gives our home directory

echo $HOME

/home/ganesh

 

PATH:

Tells all the directories in which binary files can be extracted

e.g.

echo $PATH

 

Find Command :

Used to find files and directories and perform subsequent operations on them. It supports searching by file, folder, name, creation date, modification date, owner and permissions

find -maxdepth 2 -iname “pledge.*” -type f

./pledge.txt

./pledge.txt.bak

-maxdepth <num> ; at most <num> searches files/directories in hierarchy.

-iname searches irrespective of the case.

-type f specifies the input type is a file.

-mindepth <num> ; at least <num> searches files/directories in hierarchy

-group <gname> ; find files/directories in which group have access permission

-user <uname> ; find files/directories in which user have access permission

-size ; find files/directoriesbased on size

-delete ; to delete the found files/directories

-atime -<min> | +<min> | <min> ; find the file which accessed in at given minutes <min> | less than given minutes (-<min>) | greater than given minutes (+<min>)

-atime ; similarly for days

-ctime, -cmin ; similarly for changed files

-mtime ; similarly for modified files


-exec ; to execute shell command on founded files/directories

find -maxdepth 2 -iname “pledge.*” -type f -exec cat {} \;

find -maxdepth 2 -iname “pledge.*” -type f | xargs cat


find -empty:

./cat

./empty_file.txt

finds all empty folders and files in the entered directory or sub-directories.

 

Grep:

grep searches for PATTERNS in each FILE.  PATTERNS is one or more patterns separated by newline characters, and grep prints each line that matches a pattern.  Typically, PATTERNS should be quoted when grep is used in a shell command.

A FILE of “-” stands for standard input.   If no FILE is given, recursive searches examine the working directory, and nonrecursive searches read standard input.

grep <Option> <SearchText/Reg Expression> <Target file/ Path > ; general form

options:

-E ; extended regular expression.

-i ; ignore case

-v ; invert

-l ; list files which has the text/pattern

-r ; recursive search on all files in given <path>

-R ; recursive dereference (open symbolic link).

-c ; count matched text/pattern

-n ; print output with line number

-e ; search for multiple pattern

Example: grep -e “-e” -e “[a-zA-Z]*nary” <target> ; search for “-e” and string end with “nary”

-B <number> ; print <number> lines before matched line

-A <number> ; print <number> lines after matched line

-C <number> ; print <number> lines before and after matched line

-f ; take each line in a file as pattern è Example : grep -f <pattern file> <Target file/ Path>

 

Business Simulation

~Shimalini and Aravindh

Business Simulation is an experimental learning tool where participants learn by running a virtual business in an interactive, risk-free and hyper – realistic environment. It helps in practising and improvising business skill such as Business insights, market analysis, operations, decision making, problem-solving, communication and leadership.

The advantages of this tool are:

  • Puts theoretical concepts into practice
  • Increases decision-making skills
  • Boosts participants engagement 
  • Provides a practical environment for soft skill development
  • Allows us to overcome loss aversion

Last week we had the opportunity to do the business simulation with the overall team. It was a different experience where we learnt a lot of things. The interaction happened through zoom meetings. We got the chance to interact with the Quilt.ai team globally. Each round of competition indicated one production year. The simulation system consisted of four sections: Research and Development, Operations, Marketing and Finance. There were four countries to set up our manufacturing plants – the United States, Germany and China. The game consisted of six years to develop their company’s productivity, capital, market, etc. 

The Capsim business tool is beneficial to both participants and instructors. The initial training and assessment gave us basic knowledge to operate the game. In the first three rounds, we were randomly tuning the values to get good results, encountered lot of difficulties, like running out of funds and triggering emergency loans. After 3rd round, we had some clarification in the process improved our performance by analysing the feedback, comparing other team’s performance and made conscious decisions. 

The overall process was very new to us. There were experienced members in my team; I had the opportunity to interact, learn and hear their thoughts. Our part in this simulation was minimum. The key takeaway from this business tool is that it allowed us to realise that we should undertake calculated risks. We are looking forward to having a similar experience in the future.

SED command

~Saranya

sed ‘s/find/replace/’ filename

Find and replace a word in a file

Ex output:

sed ‘s/find/replace/1’ filename

It will find and replace in line 1

sed ‘1,3 s/find/replace/1’ filename

It will find and replace with the given range

Ex output:

sed ‘s/find/replace/g’ filename

Find and replace all the occurrences in a line.

sed ‘1,5 s/setof/set/g’ auto.tcsh |sed ‘10,15 s/e/0000/g’  |head -15

Replace the string within the given range.

Unix commands Session

~Ranjith

In the layout team, we are learning UNIX command with the support of Sanjeev to improved our skills for automating tasks.

Session on process, kill, disk utility, alias, pushd, popd, tar, and gzip commands:

Process command:

To find process which are all running use “ps” command

ps -ef ; print each (all) process

ps -u <userName>; print process by user

ps -g <groupName>; print process process bu group

groups <username> ; to find group in which user is.

Kill Command:

Used to kill process

kill <signal> <pid> ; send a signal to process <pid>.

kill -l ; signal list;

kill -9 <pid>; -9 is a kill signal

kill -9 -1 ; all process it can.

xkill ; Select the window whose client you wish to kill with button 1….

Disk utility commands:

du -b <path> ; print file space in bytes

du -m <path> ; print file space in megabytes

du -k <path> ; print file space in kilobytes

du -h <path> ; print file space in human readable form.

du -d <depth> -h ; print all files space in given <path> with a given depth.

df -h ; print mounted disk space detail in human readable form

  • To find biggest file:
    • du -b | sort -nr ; sort file based size (bytes), In sort è n = combine digits into number, r = reverse order
  • To find smallest file:
    • du -b | sort -n ; sort file based size (bytes), In sort è n = combine digits into number
Send process into background and bring it foreground:

Press Ctrl+z to suspend process.

Type bg to send process into background

Type “jobs” to get job ID.

Type “fg %<job ID>” to bring process into foreground

Alias: set a alternate name to a command or a group of command within quotes separated “;”

alias ls ls -la –color=auto ; set “ls” as a “ls -la –color=auto”.

alias DoYouWantContinue ‘echo “\nDo you want to continue (Y/N):” ; set input = $< ; if($input != “Y” && $input != “y”) exit’ è set DoYouWantContinue as a set of command separated by “;”.

Unalias <alias Name> ; to remove alias;

/<command> ; to run raw command; even when command name is aliased to something else.

Change directory :

cd <path> ; change directory to given path.

cd – ; last cd path.

pushd <path> ; push directory into stack and cd to it.

pushd +<rotate stack number> ; rotate the stack

popd ; pop the top directory in stack

Create Archieve:

tar -cf <archive.tar> <directory> ; Create archive.tar from <directory>, it is like git version control.

tar -tvf <archive.tar> ; List all files in archive.tar verbosely.

tar -xf <archive.tar> ; Extract all files from archive.tar.

tar -d -f <archieve.tar> <directory>; show the difference between tar and files in directory.

tar -u -f <archieve.tar> <directory>; create a new entry for all files with new time stamp(if file is modified).

tar -r -f <archieve.tar> <directory>; append a new file in tar file.

tar -xvf auto.tar test.tcsh –occurrence=2 ; extract 2nd occurrence of test.tcsh file in auto.tar tree.

Compress:

gzip -c <file> ; compress file

gzip -d <file> ; decompress file

gunzip <file> ; unzip file

 

US Election Model

~Sharat Kumar & Vasanth

The power of predictive modelling and Machine Learning in particular. We had an opportunity to put it to test, by working on the prediction of the US election, a couple of weeks prior to the US Presidential Election. WE approached this using supervised learning. First, we considered two states of America, Texas (Republican/healthy Red state) and California (Democratic/ strong Blue state). We scraped around 10000 tweets for 5 Days from twitter for both the states. We tagged red as Pro-Trump/Anti-Biden and treated Blue as  Pro-Biden/Anti-Trump. 

We selected 100 top Fans of Biden and Trump across the US, and we scraped tweets relevant to US elections from those handles for one day. We trained a model using those tagged data into an AI machine. After training, the tool considers 70% of the data to train and the rest 30% for validation and testing. During the process, a confusion matrix is formed. A confusion matrix is a table describing the performance of a classification model (or “classifier”) on a set of test data for which the correct values are known. 

This table shows how often the model classified each label correctly (in blue), and which labels were most often confused for that label (in grey). 

We created two models out of them, in one model, when we feed an individual’s tweet history into the machine, it will identify whether the person is a Trump/Biden fan. Another model is when we provide the Twitter data of a particular state; the model predicts who has more support in that state. We used the second model, and we fed the twitter data of 11 swing states in the US. 

States Red Blue Predicted Result Actual Result
Concord (New Hampshire) 36.48% 63.52% Blue Blue
Florida 47.29% 52.71% Blue Red
Iowa 51.01% 48.99% Red Red
Michigan 31.34% 68.66% Blue Blue
Minnesota 43.79% 56.21% Blue Blue
Nevada 37.22% 62.78% Blue Blue
Ohio 42.32% 57.68% Blue Red
Pennsylvania 43.18% 56.82% Blue Blue
Raleigh (North Carolina) 46.27% 53.73% Blue Red
Virginia 44.80% 55.20% Blue Blue
Wisconsin 43.01% 56.99% Blue Blue

In 8 states among the 11, we predicted the right result. We got an accuracy of 72.72% as our result. 

This gave a first hand experience of the power of AI and Machine learning. While these tools can be used to predict and prescribe inputs for various business decisions it can also be an effective platform for addressing several complex societal problems. We are excited to engage and learn more on the underlying capabilities these new age platforms offer.

 

International webinar on Digital divide

 

~ Poovizhi.P

I’ve got an opportunity to speak in an international webinar organized by Dr. Monica Sharma on the topic digital divide. Below is the link to a 6 min video of the speech. It was a great experience to be part an international webinar. I learnt that where ever I may be and whatever work I do, I am connected with each one of us in the world in breaking the unhealthy isms from being in my inner capacity.

Here is what I shared.

In my experience one digital divide is employment. People who have completed Engineering in and around my village have hard time finding engineering jobs. Some of my engineering classmates, specifically girls have got married, others work in non-engineering jobs like receptionist, data entry and teaching.

This is partly because of lack of practical skills. Even in college where I was doing a degree in computer science we had limited access to few shared computers. It was enough to read text books and pass exams. Most of us didn’t have access to laptops and internet at home to explore further. After 4 years I had a degree but not much programming skills.

At STEM land I learned programming first with a visual programming language from children and then professional programming languages. When I was learning programming from children, no one made fun of me. In time I realized that a supportive environment for learning had been built at STEM land not only by the facilitators, but also the children who also practice the RTL tools. I see such a culture of supporting risk takers shifting mediocracy to excellence.

STEM lands are located in rural schools. Even with poor internet children are able to share the projects and programs they make with other children through a local area network. Through this I see the shift from being stuck without resources to having the courage to create alternatives.

There is digital divide in rural area due to the socio- economic background and very few people have access to computers, laptops and tabs. Many people have access to smart phones but internet is an issue. They have limited internet because the tower is not close or may not be able to afford internet. In the pandemic this got worse because people are earning less. To reach children in this time we send practice assignments and give feedback through Whatsapp. For those who don’t have access to internet I create physical worksheets that parents pick up or met children individually at home.

I can see that genderism is strengthened by society in technology. After certain age girls have a lot of constraints in my society. For example, boys have the freedom to come to STEM land in the evenings after school whereas girls do not. One issue is safety due to alcoholism, gangs and harassments in the evening, but much of it is social pressure. In response sleepovers where both boys and girls stay over at the school once a week has become a norm at least in one of our schools.

I wanted children from other villages and schools to also benefit from STEM land in the evenings. I faced the same constraints and fear of traveling, but I don’t want to leave it just because I am born as girl. I go to such a center and support children and take precautions that I can.

In my village alcoholism is a major issue and many children and women suffer as the men beat their wife and children and they don’t have a quiet space at home to study. The youth planned a play to bring awareness about alcoholism but none of girls participated because it is not considered socially ok. I had a fear of judgment but I noticed it and being in my values I took part. This action inspired four other girls and a married women. This has started many new conversations about alcoholism.

As a team in STEM land we look to break these isms in technology. When I joined STEM land three years ago there was only one female engineer. The women to men ratio was 1:6 and now in the technical team its getting closer to an equal ratio.

To break the digital divide

1. I need to develop an environment for youth and children to develop skills

2. I need to be more than an engineer to break genderism, groupism, alcoholism, ageism

3. I need to work from responsibility, equality and courage to create.

Choice Architecture: Nudging students to make better choices

~Aravindh & Sunil

Choice architecture is a method to extend multiple choices to individuals and giving them liberty in choosing an option coherently. In Choice architecture, consumer behaviour is taken into consideration while designing the alternatives and represented in a way that individuals select the option that is more aligned to  the provider. In schools, choice architecture is an excellent way to improve students’ physical and mental well being. Healthy habits can be nurtured in children using Choice architecture.

In one of the outreach schools in Auroville,  around 4 in 10 students were anaemic. Students eschewed nutritious snack and preferred tasty snack. In this case, children are often under a familiarity bias. A familiarity bias is when one decides to stay within their comfort zone. In this case, children portray absurdity heuristics; they tend to put away the nutritious food. They didn’t want to consume healthy food separately. To overcome this, the facilitators came up with a brilliant idea to blend drumstick leaves, dates, and peanuts (which are rich in iron) with porridge to keep the taste balanced with nutrition. After that, students preferred this snack and started to consume without any excuses. This nutritious mix meal resulted in a significant improvement in their health. 

The core driver behind this action is that the mere thought of eating food reminds us of how we feel when we eat it. Digestion starts with sight and smell. Instead of giving nutritious food separately, we can blend both nutritional and non-nutritional elements in the lunch meal. Children usually default to choices which are suitable to their taste and tend to take smaller portions that are easy for them to digest. By disguising nutritious food as per their preferred taste and size, we can nudge them to have a healthy meal.

Math Learning from Sundaram Sir

~Saranya

We have learnt the following topics and few techniques, puzzle(ken-ken) also learnt new information like Kaprekar constant, Collatz conjecture in excel. September 11(world trade centre hijacked)  etc…

S.No Topic Link
1 Place value (i) part 1: https://youtu.be/wXG1F5nyLyY

(ii) part 2:  https://youtu.be/ySa-8k5UnZc

(ii) part 3: https://youtu.be/t_tN0s4gnhI

2 Place Value real life examples https://youtu.be/HEgijGQABEw

 

3 Addition stories https://youtu.be/B0i-AFqh3l4

 

4 Word problem(Add-2 types, Sub-4 types) https://youtu.be/jV5-Pa2C73E
5 Word problem(Add-2 types, Sub-4 types, and division -2types) https://youtu.be/gOszHLHMgKI
6  Equal sharing along with multiplication https://youtu.be/kERMsSkW6pE
7 Ratio https://youtu.be/h5SV_uPpCrA
8 Difference between history and concepts

 

Geometry

 

Ken-ken(sudoku)

(i) part 1: https://youtu.be/qJS0R_xBDvU

(ii) part 2: https://youtu.be/f4HbQM3qma8

(ii) part 3:  https://youtu.be/tCuZMkZ9yds

9 Geometry(triangles(scalene), parallelogram, rhombus) https://youtu.be/k7dOko_vZEk
10 Word problem https://youtu.be/QMBqxF1BHaE
11 The surface area along with examples

Fraction

https://youtu.be/-F-8pN4MAyM
12 Fraction Addition and subtraction

Comparison of fraction

Stories for fraction

https://youtu.be/nTrfFKgWkYU
13 Fraction rule

Fraction stories

 

https://youtu.be/7_BKXGwHijg
14 Angles, angular distance, linear distance

Types of angles

 

https://youtu.be/mWylO7CvI-E
15 Sets square – draw angles using sets square https://youtu.be/aCVnOvK6YJI
16 Types of Angles chart/family tree https://youtu.be/0SxEwisQnL4