Coder Social home page Coder Social logo

lab_recursion_lambda's Introduction

LAB_RECURSION_LAMBDA

1) Using recursion, if given a word/phrase return how many vowels(a,e,i,o,u) are in that phrase or word:

Note: the function should be able to count how many vowels no matter if it is lowercase or uppercase .

Example: given the phrase I love python , it should return : 4

2) Given a list of numbers : [40,35, 10, 15, 20]

create a new list containing each number from the previous list mutliplied by itself.

print the new list.

Note: use map() with a lambda funciton

Bonus (solve in a new file)

Exercise: FizzBuzz

FizzBuzz is a common coding problem that asks you to print the numbers from 1 to 100. However, there are a couple of exceptions:

  1. For multiples of three, print "Fizz" instead of the number.
  2. For multiples of five, print "Buzz" instead of the number.
  3. For numbers which are multiples of both three and five, print "FizzBuzz".

Try to write a Python program that accomplishes this task using a function with a "for" loop. After you've completed that, try to write the same program but using a "while" loop instead.

Remember to test your code to ensure it's working as expected!

Hints:

  • You can use the modulus operator % to check if a number is a multiple of another number. For example, n % 3 == 0 checks if n is a multiple of 3.
  • For the "for" loop, consider using the range function.
  • For the "while" loop, you'll need to manually increment your counter.

lab_recursion_lambda's People

Contributors

aqeel-aleid avatar e7gx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.