Code Monkey home page Code Monkey logo

20-questions's Introduction

20 Questions

As per this blog post, I hope to provide 20 questions for beginners, and intermediate programmers, that will help in achieving some level of confidence in skills with programming languages and frameworks.

20 questions

Each question will require a practical solution, and the concepts you're expected to have mastered by the time you accept it, will be given in detail.

This is not an list of algorithm exercises.

See answers.

Find the questions below:

1. Name Concatenation

Request the user's first name, last name and age. Print out Welcome, <First-Name> <Last-Name> (<Age>) in a new line. See Variants.

2. Lottery

Ask the user to press any key.

Display any 3 random space-separated digits between 0-9 e.g. 6 2 7.

If any of them is 7, output "Congratulations!".

Else, output "Try again! Better luck next time.".

Repeat. See Variants.

3. Word in Reverse

Ask the user to enter a word.

Print out the word in reverse.

Repeat. See Variants.

4. Type in Reverse

Output a random word. Ask the user to type in the reverse.

  • If the user is correct, output โœ…

  • Else, output โŒ

Repeat. See Variants.

5. Temperature Unit Conversion

Output:

1. Celsius to Fahrenheit
2. Fahrenheit to Celsius

Enter an option:
  • If the user enters 1, ask the user to "Enter a celsius value:".

  • Else, ask the user to "Enter a Fahrenheit value:".

Convert the entered value to celsius or fahrenheit accordingly. See More.

6. Multiplication Table

Using a for/while loop, write a program that prints out a simple multiplication from 2 - 12. E.g.

2   3   4   5   6   7   8   9   10  11  12
4   6   8   10  12  14  16  18  20  22  24
6   9   12  15  18  21  24  27  30  33  36
...
24  36  48  60  72  84  96  108 120 132 144

See Variants.

7. Read line by line

Write a program to read a txt file, line by line, and output each line to the screen. See Variants

8. Combine Two Files

Write a program to read two txt files, line by line, concatenate each line pair for both files, and output the concatenated result to the screen. See more

9. RGB Color Generator

Write a program that will output a random RGB color e.g. rgb(252, 160, 72).

See More.

10. Hex Color Generator

Write a program that will output a random RGB color e.g. #fca048.

See More.

11. Extract File Extension

Write a program to read a list of file paths, and output the extension for each.

See More.

12. Salary Classifier

Ask the user to enter a salary amount.

  • If the salary is < 50,000, output "Basic Earner".

  • Else, if the salary is less than 200,000, output "Mid Earner".

  • Else, output "High Earner".

See More.

13. Tax Classifier

Ask the user to enter a salary amount.

  • If the salary is < 50,000, output Tax: 5 / 100 * salary.

  • Else, if the salary is less than 200,000, output Tax: 10 / 100 * salary.

  • Else, output Tax: 15 / 100 * salary.

See More.

14. Number in Words

Ask the user to enter a number.

Print out the entered number in words.

E.g. 30,456 becomes "Thirty thousand, four hundred and fifty six".

See More

15. Compound Interest Calculator

Request the Principal.

Request the Rate.

Request the Time in Years.

Calculate and output the simple interest. (P * R * T / 100).

For each year, calculate and output the compound interest.

See More.

16. Convert to Decimal

Write a program to convert from base n to decimal (base 10).

Request the value of n.

Request the number value (integer).

Convert to base 10, and output the result.

See More

17. Convert Decimal to Base n

Write a program to convert from decimal (base 10) to base n.

Request the value of n.

Request the decimal value.

Convert to base n, and output the result.

See More

18. Simple CGPA calculator

Write a program to read a CSV file of student IDs, names, and scores, and for each student, output their name, ID, average score and CGPA in the following format:

<name> (<id>): <average-score> <cgpa>

See more.

19. Attendance Register

Read student names, line by line, from a file.

For each name, ask if the student is in class.

E.g. Is Bisi in class? [yes/no]

Let the user input either yes or no.

See More

20. Love Calculator

Write a love calculator program that calculates a love percentage, using two names. See More.

looking to contribute? checkout the contributing guide

20-questions's People

Contributors

bolajiolajide avatar cfcife avatar eronmmer avatar mykeels avatar oseme-techguy avatar prondubuisi avatar thecarisma 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.