# Learning Plan https://replit.com/ ## Make a Plan - [ ] Setup/Create Twitter Account - [ ] Start 100 Days of Coding Challenge - [ ] Create a new repo for basic Python exercises - [ ] Make a commit on Github - [ ] Tweet that you made your first commit on Twitter - [ ] Create another Repo for SimpleCalc project - [ ] Tweet about the project - [ ] Write a blog post ## Setting a collaborative environment - [x] Online document where we can share code - HackMD - [x] Github account to use as the default login - [ ] Define how to use this document - [ ] Define syllabus ## How to use this document 1. When starting a new tutorial, write out the topic name here and a link to the source if possible. # Basics ## Get Python installed Get Python installed - Automate the Boring stuff with python - Udemy 1. Installed Python (verison 3) 2. Started Idle 3. Understood how interactive shells work ## Calculations Adding, subtracting Expression = values + operators ## Data types Whole number = Integers (int) Decimals = Floating points (flot) Texts = String concatenation (string) Strings beings and ends with '' An instruction that evaluates to a single value is an expression. An instruction that doesn't is a statement. #comment - python ignores statements that start with # - useful to write notes/reminders to yourself ## Variables Values can be stored in variables Assignment Statement ex. Rashmi = me Variables can also be used in expressions ex me + 1 ## Example of a program ```lang.py #This program says hello and asks for my name and age print('Hello World') #ask for their name print('What is your name?') myName=input() print('It is nice to meet you, ' + myName) print('The lenght of your name is: ') print(len(myName)) #ask for age print('What is your age?') myAge = input() print('Your age will be ' + str(int(myAge) + 1) + ' in a year') ``` ## Types of Data Boolean Values - True or false ## Check your understanding Here's stuff we will go through together today. - [ ] What's a variable? :) # Exercises ## Write a program to calulcate the average of 3 numbers ### Description Your program accepts 3 numbers, calculates the average and prints it out as `The average is X` ### To Dos - [ ] We ask the user through the commandline prompt for input 1,2,3 - [ ] Execute the formula to calculate average - [ ] Print the solution ### Implementation Testcases: - [x] Calculate average of 2, 3, 4, print `The average of the three numbers is 3` - [x] Calculate average of 22, 400, 168, print `The average of the three numbers is 196.666` ```lang-py print('Let us calculate the average of three numbers') print('What is the first number?') numberOne = input() print('What is the Second number?') numberTwo = input() print('What is the Third number?') numberThree = input() print('The average of the three numbers is:') sum = int(numberOne) + int(numberTwo) + int(numberThree) average = sum/3 print(average) ``` ## Write a program calculate the average of any given numbers until the user wants to stop https://replit.com/@larrydalmeida/RedFairDiskdrive ### Description Your program accepts any number of input numbers from the user, calculates the average and prints it out as `The average of [A,B,C...] is Y` ### Testcases: - [ ] Calculate average of 2, 3, 4, print `The average of the three numbers is 3` - [ ] Calculate average of 22, 400, 168, print `The average of the three numbers is 196.666` - [ ] Calculate average of 2, 3, 4, 5 print `The average of the three numbers is 3.5` - [ ] Calculate average of 24, 28, 22, 400, 168, 80 print `The average of the three numbers is 120.333` ### Milestones - [ ] Draw a flowchart of the problem on a piece of paper and upload the picture here - [ ] Write the program ### Implementation ```lang-py print('Enter a number, type STOP when done to calculate average') for index in range(10): print(index) ``` ### Work Packages - [ ] Print message to inform user "Enter a number or type stop when done" - [ ] HMW move forward with a while loop - [ ] HMW reduce the number of repitions