Skip to content

RosaleeKnight/basic-scripts-collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitHub top language GitHub language count GitHub GitHub issues HitCount

🖥️ Basic Scripts Collection

This is a collection of basic scripts to common programming problems I've been asked in the past.


🖱️ Contents JavaScript

  • Anagram Write a function to check whether two strings are anagrams of each other. If so return "are anagrams" and if not return "are not anagrams." (Sort the letters of each string alphabetically and compare if they are the same.)
  • Fibonacci Sequence Write a function to find the 1000th term in the Fibonacci Sequence. (Calculate using the fibonacci formula and tail recursion to avoid crashing at large numbers.)
  • FizzBuzz Write a function that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. (Using remainders check if something is a multiple of 3 and 5, just 3 or just 5. Log the rest of the items.)
  • Palindrome Checker Write a function that when given a string returns true if the string is a palindrome or false otherwise. (Remove all empty space in the string, set to lower case, reverses a copy and see if it's the same as the original.)
  • Pascal's Triangle Write a function that finds the elements of the 9th row of Pascal's Triangle. (Create the triangle, get the previous line, create a new line, populate it and insert the new line. Use recursion and return the values in an array.)

🖱️ Contents Python

  • Add Prices Write a function that adds the prices of groceries in a cart. (Use a dictionary and add contents.)
  • Convert Distance Write a function to turn miles into kilometers. (Multiply distance by 1.6.)
  • Describe Furniture Write a function to describe how a piece of furniture looks. (Define what each piece looks like then call the item to insert the information.)
  • Exam Grade Write a function for grading tests. 90% is top score, 70% is pass and everything else is a failing grade. (Use if then elif then else statements to define.)
  • Format Address Write a function takes an address and describes the location. (Split the string, use isdigit to get the number listed then return the rest.)
  • Greeting Write a function when receiving a name returns a greeting based on whether or not it's the boss. (Use if and === to test names.)
  • Name Tag Write a function to create a name tag with the persons full first name and first letter of their last name. (First name plus position 0 of last name.)
  • Prime Factors Write a function for the first 100 prime factors. (Start at 2, check if dividable, if so print if not add 1.)

❔ How to use

All code is live on replit to see. Click on the names to be taken to the repl.

About

Simple programming problem solutions in a collection.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published