Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save leenswitts/050692f02c6fd60d68510e79316036e1 to your computer and use it in GitHub Desktop.
Save leenswitts/050692f02c6fd60d68510e79316036e1 to your computer and use it in GitHub Desktop.
Beginner Dart Practice – Questions Only

Dart Practice Exercises for Beginners (Questions Only)

Compiled from: https://hackmd.io/@kuzmapetrovich/S1x90jWGP


  1. Create a program that asks the user to enter their name and their age.
    Print out a message that tells how many years they have to be 100 years old.
    👉 Reference

  2. Ask the user for a number.
    Depending on whether the number is even or odd, print out an appropriate message to the user.
    👉 Reference

  3. Take a list, for example this one:
    a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
    and write a program that prints out all the elements of the list that are less than 5.
    👉 Reference

  4. Create a program that asks the user for a number and then prints out a list of all the divisors of that number.
    👉 Reference

  5. Take two lists, for example:
    a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
    b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
    and write a program that returns a list that contains only the elements that are common between the lists (without duplicates).
    👉 Reference

  6. Ask the user for a string and print out whether this string is a palindrome or not.
    👉 Reference

  7. Let’s say you are given a list saved in a variable: a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
    Write a Dart code that takes this list and makes a new list that has only the even elements of this list in it.
    👉 Reference

  8. Make a two-player Rock–Paper–Scissors game against the computer.
    Ask for player input, compare inputs, print results.
    👉 Reference

  9. Generate a random number between 1 and 100.
    Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right. Keep track of how many guesses the user took.
    👉 Reference

  10. Ask the user for a number and determine whether the number is prime.
    Use a Dart function to make the check.
    👉 Reference

  11. Write a program that takes a list of numbers and makes a new list of only the first and last elements.
    For example, if the list is [5, 10, 15, 20, 25], the output should be [5, 25].
    👉 Reference

  12. Write a Dart function that prints out the Fibonacci sequence up to n terms.
    Ask the user how many Fibonacci numbers to generate.
    👉 Reference

  13. Write a function that takes a list and returns a new list with only unique elements.
    Do not use the built-in Set feature.
    👉 Reference

  14. Ask the user for a sentence.
    Print out the sentence with the words in reverse order.
    👉 Reference

  15. Write a password generator.
    Ask the user how strong the password should be (weak, medium, strong). Generate a random password accordingly.
    👉 Reference

  16. Cows and Bulls Game
    Generate a 4-digit random number. For each guess, return the number of cows (correct digits in the right place) and bulls (correct digits but in the wrong place).
    👉 Reference

  17. Ask the user for the size of a game board (e.g., 3), and print a square game board of that size.
    👉 Reference

  18. Write a Dart function that checks if someone has won a Tic-Tac-Toe game.
    The board is a list of lists. Check for wins via rows, columns, and diagonals.
    👉 Reference

  19. Draw the Tic-Tac-Toe game board and allow players to pick a position and place their symbol (X or O).
    👉 Reference

  20. Build a complete two-player Tic-Tac-Toe game.
    Combine board drawing, player input, and win condition checking.
    👉 Reference

  21. Write a program where the computer guesses a number you’re thinking of between 0 and 100.
    The user tells the computer if the guess was too high, too low, or correct. Report how many guesses it took.
    👉 Reference

  22. Write a Dart function that takes three numbers and returns the largest.
    Do not use built-in max() functions.
    👉 Reference

  23. Pick a random word from the SOWPODS dictionary.
    The word list can be read from a file.
    👉 Reference

  24. Create a single-player Hangman game.
    Ask the user to guess letters, display progress, and keep guessing until the word is complete.
    👉 Reference

  25. Extend the Hangman game.
    Limit the user to 6 wrong guesses, track used letters, and ask if they want to play again. Optionally add ASCII art.
    👉 Reference

  26. Create a birthday dictionary.
    Store names and birthdays. Ask for a name and return the birthday.
    👉 Reference

  27. Allow the user to add new birthdays to the dictionary and save to a JSON file.
    👉 Reference

  28. From the birthday data, count how many birthdays are in each month.
    Display results in a readable format.
    👉 Reference


🟡 Tip: Work through each problem incrementally. Start with simple prints and inputs, then build up to logic and functions.
📦 Happy Dart coding!

Comments are disabled for this gist.