A list of tasks for learning the fundamentals of coding in any language
by Nik MalevFeb 1, 2021
Here is a list of beginner programming assignments designed to gradually introduce concepts, serve as a reference and train you to think in a problem solving mindset. They have been written with the purpose of learning Python in mind - but they can be applied to any language.
You are allowed ( and encouraged ) to use the internet to look for solutions. One of the most important skills a coder needs is being able to autonomously solve problems. You must learn how to google the right search terms and find the answer within the documentation, stack overflow, GitHub issues, wherever it may be.
Tasks
Level 1:
- input - Ask the user for an input (their name). Print it out "Your name is ____"
- add - Ask the user for a number. Then ask for a second number. Then add them together
- isOddOrEven - Declare a number as a variable and then prints if it is odd or even
- getHigher - Write a function that takes two numbers and returns the higher value
- printList - Take an array (list) of strings and print each value
Level 2:
- sumOfList - Write a function that takes an array of numbers, adds them all together and print the result
- getLongest - Write a function that takes an array of strings and prints the string with the most characters
- importLongest - Import the function you defined in getLongest and call it on a new list of strings.
- todayIs - Print todays date (hint: import a module)
Level 3:
- headsOrTails - Write a function that randomly prints either heads or tails.
- isPalindrome - Determine if a string of characters is a palindrome. Account for spaces and punctuation (see below for examples)
- calculator - Ask the user to input two numbers. Then ask if they would like to Add, Subtract, Divide or Mulitiply the two numbers and print the output.
- fibonacci - Write a function that takes a number, then prints the Fibonacci sequence that many times.
Concepts
Level 1:
- Input - input, print
- Addition - type conversion
- isOddOrEven - variables, if/else
- isHigher - functions
- printList - loops, arrays
Level 2:
- sumOfList - loops, arrays, variables
- getLongest - loops, arrays
- importLongest - importing internal modules
- todayIs - importing external modules
Level 3:
- headsOrTails - randomisation
- isPalindrome - string manipulation (stripping unnecessary characters)
- calculator - if/if else/else
- fibonacci - loops, variables
Good luck!