Using examples largely gotten from the below video and previous experience, this repository summarizes a process of learning or getting familiar with a programming language. https://youtu.be/87SH2Cn0s9A?si=LcluVxABoh2NW0bj
- Printing to terminal/commandline
- variable deceleration and datatypes
- operators (e.g arithmetic. logic and tenary) [1]
- conditional statements (if, if/else etc.)
- loops (for, while etc.)
- Collection objects e.g List/Arrays, Set etc.
- input/output (accepting user input mostly)
- files (reading from and writing to files)
[1] arithmetic operators represent addition, subtraction etc. logical operators represent AND, OR etc.
- functions and parameters/arguements
- Classes/Struct
- Memory management e.g Allocators, Constructors etc.
- decorators
The below exercises can be used to get familiar with the syntax of a language and can be done with the various level of user interactivity. Write a program that does the below:
-
Calculate the circumference of a circle, i.e. 2PIr, where r is a variable you have assigned a value to.
-
Calculate the value of x in the formula i.e x^2 = y^2 + z^2.
-
Convert a given temprature unit from Celcius to Farenheight or from Farenheight to Celcius depending on the user input (conditional statements).
-
A calculator that takes two inputs and an operator and performs the associated mathematical operation e.g inputs '6', '4' and '+' would output 10 as 6+4=10. This can be done with and without using functions/procedures. (conditional/switch statements).
-
Takes a temprature measurement and prints if the temprature is hot, cold or warm depending on the value. Hot, cold and warm values fall within ranges (conditional statements).
-
Request a piece of information from a user a given number of times and give a response either when the correct information is passed or the request has been made that number of times. (loops).
-
Request a piece of information from a user and repeat the request until the user give an acceptable response (loops).
-
Iterate over a list/array and print each of it's elements to the screen/terminal. e.g [6, 12, 24, 48, 96] or it's floating point equivalent. (collection objects).
-
(optional/language dependent) Given an array/list [1, 2, 3, 4, 5] remove 4 from the array to give [1, 2, 3, 5]. Then add 6 to give [1, 2, 3, 5, 6]. (mutable collection objects).
-
Given the below 2D array/list
[ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]
Sum up the elements in each row to get
[ [6], [15], [24] ]
Get the mean of the elements in each row to get
[ [2], [5], [8] ]
-
For the same 2D array,
[ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]
sum up the elements in each column to get,
[ [12, 15, 18] ]
Get the mean of the elements in each row to get,
[ [4, 5, 6] ]
14. Implement the functionality of all above exercises as functions. 15. Implement a class or struct that represents a person who has a name and an age. 16. Implement a class or struct that represents a player of a a club. The class/struct has a name, age, club, player number and an array of previous played numbers. Inheritance should be used if possible. 17. (language classes) Implement methods/functions for the player in above exercise. The player could be running, walking or jogging. Implement a function(s) that would print to terminal the status of the player.
x. implement three sorting algorithms to sort the array/list [4, 3, 7, 7, 0, 5]
(functions)
x. solve a dynamic programming problem, one using recursion and the other the bottom-top method.