├── project05_word_counter └── readme.md ├── project08_quiz └── readme.md ├── project09_countdown_timer └── readme.md ├── project03_todo_list └── readme.md ├── project10_oop └── readme.md ├── project02_atm └── readme.md ├── project11_oop_mybank └── readme.md ├── project01_number_guessing-game └── readme.md ├── project07_adventure_game └── readme.md ├── project04_currency_converter └── readme.md ├── project06_student_management_system └── readme.md ├── LICENSE ├── project00_calculator └── readme.md ├── README.md └── getting-started-exercises.md /project05_word_counter/readme.md: -------------------------------------------------------------------------------- 1 | # Word Counter 2 | 3 | The user will enter a english paragraph and all that is needed is to just to implement counting characters and words without whitespaces. 4 | 5 | Create a GitHub repository for the project and submit its URL in the project submission form. -------------------------------------------------------------------------------- /project08_quiz/readme.md: -------------------------------------------------------------------------------- 1 | # Quiz System 2 | 3 | The app will show the students multiple choice questions and promt the user to reply. In the end it will show the students the result of the quiz. 4 | 5 | Create a GitHub repository for the project and submit its URL in the project submission form. -------------------------------------------------------------------------------- /project09_countdown_timer/readme.md: -------------------------------------------------------------------------------- 1 | # Countdown Timer 2 | 3 | In this project, you will build a countdown timer using the [date module](https://usefulangle.com/post/187/nodejs-get-date-time). 4 | 5 | Create a GitHub repository for the project and submit its URL in the project submission form. 6 | 7 | 8 | -------------------------------------------------------------------------------- /project03_todo_list/readme.md: -------------------------------------------------------------------------------- 1 | # Todo List 2 | 3 | # Simple Command Line Calculator 4 | 5 | Develop a simple command line Todo app using [TypeScipt](https://www.typescriptlang.org/), [Node.js](https://nodejs.org/en/) and [Inquirer](https://www.npmjs.com/package/inquirer). 6 | 7 | Create a GitHub repository for the project and submit its URL in the project submission form. -------------------------------------------------------------------------------- /project10_oop/readme.md: -------------------------------------------------------------------------------- 1 | # OOP Introduction Explained with a TypeScript Console Application 2 | 3 | In this project you are going to follow this [video](https://www.youtube.com/watch?v=QboWn0NOUA8) which explains object oriented programming using C# and write the same code in TypeScript. 4 | 5 | Create a GitHub repository for the project and submit its URL in the project submission form. 6 | 7 | -------------------------------------------------------------------------------- /project02_atm/readme.md: -------------------------------------------------------------------------------- 1 | # ATM 2 | 3 | This somewhat complex TypeScript/Node.js project is a console-based application. When the system starts the user is prompted with a user id and user pin. After entering the details successfully, the ATM functionalities are unlocked. All the user data is generated randomly. 4 | 5 | Create a GitHub repository for the project and submit its URL in the project submission form. -------------------------------------------------------------------------------- /project11_oop_mybank/readme.md: -------------------------------------------------------------------------------- 1 | # Learning Object Oriented Programming with TypeScript MyBank Console App 2 | 3 | In this project you are going to follow this [video](https://www.youtube.com/watch?v=pzZGlU0n2IU) which explains object oriented programming using C# and write the same code in TypeScript. 4 | 5 | Create a GitHub repository for the project and submit its URL in the project submission form. 6 | 7 | -------------------------------------------------------------------------------- /project01_number_guessing-game/readme.md: -------------------------------------------------------------------------------- 1 | # Number Guessing Game 2 | 3 | This guess the number game is a short TypeScript/Node.js project that allows the user to guess the number generated by the computer. There are also several ways to alter the game, like adding more rounds or displaying the score. It’s quite simple and uses the random function to generate a number. 4 | 5 | Create a GitHub repository for the project and submit its URL in the project submission form. -------------------------------------------------------------------------------- /project07_adventure_game/readme.md: -------------------------------------------------------------------------------- 1 | # Text-Based Adventure-Game in TypeScript and Node.js 2 | 3 | This project is not GUI based. It is a console-based game. The video [here](https://www.youtube.com/watch?v=EpB9u4ItOYU&t=1s) shows how to develop the game in Java. You will take the requirements of the game from the video and develop the game in TypeScript and Node.js 4 | 5 | Create a GitHub repository for the project and submit its URL in the project submission form. 6 | 7 | -------------------------------------------------------------------------------- /project04_currency_converter/readme.md: -------------------------------------------------------------------------------- 1 | # Currency Converter 2 | 3 | The TypeScript console app is used to convert currencies: the users enter a certain amount of money in one currency and set the currency they want to check the monetary value of. 4 | 5 | While developing the app, the beginners can master variables, algorithms, loops, if statements, and other TypeScript concepts. 6 | 7 | Create a GitHub repository for the project and submit its URL in the project submission form. 8 | 9 | -------------------------------------------------------------------------------- /project06_student_management_system/readme.md: -------------------------------------------------------------------------------- 1 | # Student Management System 2 | 3 | This project is a simple console based Student Management System. In this project you will be learning how to add new students, how to generate a 5 digit unique studentID for each student, how to enroll students in the given courses. Also, you will be implementing the following operations enroll, view balance, pay tuition fees, show status, etc. The status will show all the details of the student including name, id, courses enrolled and balance.This is one of the best projects to implement the Object Oriented Programming concepts. 4 | 5 | Create a GitHub repository for the project and submit its URL in the project submission form. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Panacloud Multi-Cloud Internet-Scale Modern Global Apps 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /project00_calculator/readme.md: -------------------------------------------------------------------------------- 1 | # Simple Command Line Calculator 2 | 3 | Develop a simple command line calculator using [TypeScipt](https://www.typescriptlang.org/), [Node.js](https://nodejs.org/en/) and [Inquirer](https://www.npmjs.com/package/inquirer). 4 | 5 | Create a GitHub repository for the project and submit its URL and NPX command in the project submission form. Please note that you will create a NPX command for your project and publish it on npm. After the NPX command is working you will announce it on Panaverse groups on Facebook, Discord, and Twitter. 6 | 7 | 8 | ## You can develop [CLI Games](https://www.youtube.com/watch?v=_oHByo8tiEY) using Inquirer, Chalk, etc. All your class projects will be CLI based and should be deployed as an [NPX command](https://blog.deepgram.com/npx-script/) 9 | 10 | [How to create a NPX tool](https://blog.shahednasser.com/how-to-create-a-npx-tool/) 11 | 12 | Run the following command to experience a CLI game: 13 | 14 | npx firequiz 15 | 16 | Now review the [source code](https://github.com/fireship-io/javascript-millionaire) for Firequiz game. 17 | 18 | ## [Submit your projects here](https://forms.gle/A37eRgiz46wvfTUv6) 19 | 20 | ## [Hint: Review this project before starting](https://github.com/panaverse/learn-typescript/tree/master/step03d_chalk) 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Learn Programming with TypeScript and Node.js 2 | 3 | [The repo is part of the Certified Web 3 and Metaverse Developer Program](https://www.panaverse.co/) 4 | 5 | ## [Submit your projects here](https://forms.gle/A37eRgiz46wvfTUv6) 6 | 7 | Before we start the learning process, review this articles: 8 | 9 | [TypeScript Job Postings Explode](https://visualstudiomagazine.com/articles/2022/08/24/typescript-job-growth.aspx?m=1) 10 | 11 | ## Textbooks 12 | 13 | Chapters 2-6, 13 of [JavaScript from Beginner to Professional: Learn JavaScript quickly by building fun, interactive, and dynamic web apps, games, and pages](https://www.amazon.com/JavaScript-Beginner-Professional-building-interactive/dp/1800562527/ref=sr_1_4) 14 | 15 | Chapters 1-11 of [Learning TypeScript: Enhance Your Web Development Skills Using Type-Safe JavaScript](https://www.amazon.com/Learning-TypeScript-Development-Type-Safe-JavaScript/dp/1098110331/ref=sr_1_1) 16 | 17 | ## Setup a TypeScript and Node.js Project 18 | 19 | [How to Setup a TypeScript + Node.js Project](https://khalilstemmler.com/blogs/typescript/node-starter-project/) 20 | 21 | [How to Set Up a Node.js Project with TypeScript](https://blog.appsignal.com/2022/01/19/how-to-set-up-a-nodejs-project-with-typescript.html) 22 | 23 | ## Node.js 24 | 25 | [How to read environment variables from Node.js](https://nodejs.dev/en/learn/how-to-read-environment-variables-from-nodejs/) 26 | 27 | [Node.js, accept arguments from the command line](https://nodejs.dev/en/learn/nodejs-accept-arguments-from-the-command-line/) 28 | 29 | [Output to the command line using Node.js](https://nodejs.dev/en/learn/output-to-the-command-line-using-nodejs/) 30 | 31 | ## Create a Conversational CLI User Interface 32 | 33 | Inquirer is an NPM package that provides an easy way to capture user input in your Node. js command line interface applications. It provides several methods for asking questions and returning answers from the user that can be accessed by a . then promise function. 34 | 35 | [Inquirer](https://www.npmjs.com/package/inquirer) 36 | 37 | [Inquirer Types](https://www.npmjs.com/package/@types/inquirer) 38 | 39 | [How To Create Beautiful Command Line Interactions With Node.js](https://betterprogramming.pub/how-to-create-beautiful-command-line-interactions-with-node-js-2fcdfbbac62c) 40 | 41 | [How To Create Interactive Command-line Prompts with Inquirer.js](https://www.digitalocean.com/community/tutorials/nodejs-interactive-command-line-prompts) 42 | 43 | [TypeScript inquirer prompt Examples](https://typescript.hotexamples.com/examples/inquirer/-/prompt/typescript-prompt-function-examples.html) 44 | 45 | [Building a CLI in node.js with inquirer and typescript](https://www.youtube.com/watch?v=pftXgIenGHU) 46 | 47 | [Create An Advanced CLI — With TypeScript](https://levelup.gitconnected.com/create-your-own-advanced-cli-with-typescript-5868ae3df397) 48 | 49 | [How To Create Your Own TypeScript CLI — With Node.js](https://itnext.io/how-to-create-your-own-typescript-cli-with-node-js-1faf7095ef89) 50 | 51 | [Use Inquirer.js to Create a Conversational CLI User Interface](https://pakstech.com/blog/inquirer-js/) 52 | 53 | You can develop [CLI Games](https://www.youtube.com/watch?v=_oHByo8tiEY) using Inquirer, Chalk, etc. All your class projects will be CLI based and should be deployed as an [NPX command](https://blog.deepgram.com/npx-script/) 54 | 55 | [How to create a NPX tool](https://blog.shahednasser.com/how-to-create-a-npx-tool/) 56 | 57 | Run the following command to experience a CLI game: 58 | 59 | npx firequiz 60 | 61 | Now review the [source code](https://github.com/fireship-io/javascript-millionaire) for Firequiz game. 62 | 63 | ## Fundamentals of Version Control with Git 64 | 65 | All projects will be sumitted by creating a private repository on GitHub. Please learn Git and GitHub by using these resources: 66 | 67 | [Version Control using Git and GitHub By Sir Zeeshan Hanif Videos](https://www.youtube.com/playlist?list=PLKueo-cldy_HjRnPUL4G3pWHS7FREAizF) 68 | 69 | Chapters 1, 2, 3, and 4 Learn Version Control with Git: A step-by-step course for the complete beginner by Tobias Günther 70 | 71 | We will also covers these readings: 72 | 73 | https://help.github.com/articles/markdown-basics/ 74 | 75 | http://stackoverflow.com/questions/5009600/difference-between-fork-and-branch-on-github 76 | 77 | http://stackoverflow.com/questions/3329943/git-branch-fork-fetch-merge-rebase-and-clone-what-are-the-differences 78 | 79 | https://git-scm.com/book/en/v2/Git-Branching-Rebasing 80 | 81 | http://git-scm.com/book/en/v2/Git-Branching-Remote-Branches#Tracking-Branches 82 | 83 | For practice: https://try.github.io/levels/1/challenges/1 84 | 85 | Homework: 86 | 87 | https://www.datacamp.com/courses/introduction-to-git-for-data-science 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /getting-started-exercises.md: -------------------------------------------------------------------------------- 1 | # Getting Started Exercises with TypeScript and Node.js 2 | 3 | Note: Try these short programs to get some firsthand experience with TypeScript and Node.js. 4 | You might want to create a new folder for each exercise to keep them organized. Create a single Github repository to commit the code for these exercises and once finished submit the URL of the repo. 5 | 6 | 1. Install [Node.js](https://nodejs.org/en/), [TypeScript](https://www.typescriptlang.org/download) and [VS Code](https://code.visualstudio.com/) on your computer. 7 | 8 | 2. Personal Message: Store a person’s name in a variable, and print a message to that person. Your message should be simple, such as, “Hello Eric, 9 | would you like to learn some Python today?” 10 | 11 | 3. Name Cases: Store a person’s name in a variable, and then print that person’s name in lowercase, uppercase, and titlecase. 12 | 13 | 4. Famous Quote: Find a quote from a famous person you admire. Print the quote and the name of its author. Your output should look something like the 14 | following, including the quotation marks: 15 | 16 | Albert Einstein once said, “A person who never made a mistake never tried anything new.” 17 | 18 | 5. Famous Quote 2: Repeat Exercise 4, but this time store the famous person’s name in a variable called famous_person. Then compose your message and store it in a new variable called message. Print your message. 19 | 20 | 6. Stripping Names: Store a person’s name, and include some whitespace characters at the beginning and end of the name. Make sure you use each 21 | character combination, "\t" and "\n", at least once. Print the name once, so the whitespace around the name is displayed. Then print the name after striping the white spaces. 22 | 23 | 7. Number Eight: Write addition, subtraction, multiplication, and division operations that each result in the number 8. Be sure to enclose your operations in print statements to see the results. 24 | 25 | 8. You should create four lines that look like this: 26 | 27 | _____________________________________________ 28 | 29 | console.log(5 + 3) 30 | 31 | _____________________________________________ 32 | 33 | Your output should simply be four lines with the number 8 appearing once on each line. 34 | 35 | 36 | 9. Favorite Number: Store your favorite number in a variable. Then, using that variable, create a message that reveals your favorite number. Print that message. 37 | 38 | 39 | 10. Adding Comments: Choose two of the programs you’ve written, and add at least one comment to each. If you don’t have anything specific to write 40 | because your programs are too simple at this point, just add your name and the current date at the top of each program file. Then write one sentence 41 | describing what the program does. 42 | 43 | 11. Names: Store the names of a few of your friends in a array called names. Print each person’s name by accessing each element in the list, one at a time. 44 | 45 | 12. Greetings: Start with the array you used in Exercise 11, but instead of just printing each person’s name, print a message to them. The text of each message 46 | should be the same, but each message should be personalized with the person’s name. 47 | 48 | 13. Your Own Array: Think of your favorite mode of transportation, such as a motorcycle or a car, and make a list that stores several examples. Use your list 49 | to print a series of statements about these items, such as “I would like to own a Honda motorcycle.” 50 | 51 | 14. Guest List: If you could invite anyone, living or deceased, to dinner, who would you invite? Make a list that includes at least three people you’d like to 52 | invite to dinner. Then use your list to print a message to each person, inviting them to dinner. 53 | 54 | 15. Changing Guest List: You just heard that one of your guests can’t make the 55 | dinner, so you need to send out a new set of invitations. You’ll have to think of 56 | someone else to invite. 57 | 58 | • Start with your program from Exercise 14. Add a print statement at the 59 | end of your program stating the name of the guest who can’t make it. 60 | 61 | • Modify your list, replacing the name of the guest who can’t make it with 62 | the name of the new person you are inviting. 63 | 64 | • Print a second set of invitation messages, one for each person who is still 65 | in your list. 66 | 67 | 16. More Guests: You just found a bigger dinner table, so now more space is 68 | available. Think of three more guests to invite to dinner. 69 | 70 | • Start with your program from Exercise 15. Add a print statement to the end of your program informing people that you found a 71 | bigger dinner table. 72 | 73 | • Add one new guest to the beginning of your array. 74 | 75 | • Add one new guest to the middle of your array. 76 | • Use append() to add one new guest to the end of your list. 77 | • Print a new set of invitation messages, one for each person in your list. 78 | 79 | 17. Shrinking Guest List: You just found out that your new dinner table won’t arrive in time for the dinner, and you have space for only two guests. 80 | 81 | • Start with your program from Exercise 16. Add a new line that prints a message saying that you can invite only two people for dinner. 82 | 83 | • Remove guests from your list one at a time until only two names remain in your list. Each time you pop a name from your list, print 84 | a message to that person letting them know you’re sorry you can’t invite them to dinner. 85 | 86 | • Print a message to each of the two people still on your list, letting them know they’re still invited. 87 | 88 | • Remove the last two names from your list, so you have an empty list. Print your list to make sure you actually have an empty list at the end 89 | of your program. 90 | 91 | 18. Seeing the World: Think of at least five places in the world you’d like to visit. 92 | 93 | • Store the locations in a array. Make sure the array is not in alphabetical order. 94 | 95 | • Print your array in its original order. 96 | 97 | • Print your array in alphabetical order without modifying the actual list. 98 | 99 | • Show that your array is still in its original order by printing it. 100 | 101 | • Print your array in reverse alphabetical order without changing the order of the original list. 102 | 103 | • Show that your array is still in its original order by printing it again. 104 | 105 | • Reverse the order of your list. Print the array to show that its 106 | order has changed. 107 | 108 | • Reverse the order of your list again. Print the list to show it’s back to its original order. 109 | 110 | • Sort your array so it’s stored in alphabetical order. Print the array to show that its order has been changed. 111 | 112 | • Sort to change your array so it’s stored in reverse alphabetical order. Print the list to show that its order has changed. 113 | 114 | 19. Dinner Guests: Working with one of the programs from Exercises 14 through 18, print a message indicating the number 115 | of people you are inviting to dinner. 116 | 117 | 20. Think of something you could store in a array. For example, you could make a list of mountains, rivers, countries, cities, languages, or anything 118 | else you’d like. Write a program that creates a list containing these items. 119 | 120 | 21. They think of something you could store in a TypeScript Object. Write a program that creates Objects containing these items. 121 | 122 | 22. Intentional Error: If you haven’t received an array index error in one of your programs yet, try to make one happen. Change an index in one of your programs 123 | to produce an index error. Make sure you correct the error before closing the program. 124 | 125 | 126 | 23. Conditional Tests: Write a series of conditional tests. Print a statement 127 | describing each test and your prediction for the results of each test. Your code 128 | should look something like this: 129 | 130 | let car = 'subaru'; 131 | 132 | console.log("Is car == 'subaru'? I predict True.") 133 | 134 | console.log(car == 'subaru') 135 | 136 | • Look closely at your results, and make sure you understand why each line evaluates to True or False. 137 | 138 | • Create at least 10 tests. Have at least 5 tests evaluate to True and another 5 tests evaluate to False. 139 | 140 | 24. More Conditional Tests: You don’t have to limit the number of tests you create to 10. If you want to try more comparisons, write more tests. Have at least one True and one False result for each of the following: 141 | 142 | • Tests for equality and inequality with strings 143 | 144 | • Tests using the lower case function 145 | 146 | • Numerical tests involving equality and inequality, greater than and less than, greater than or equal to, and less than or equal to 147 | 148 | • Tests using "and" and "or" operators 149 | 150 | • Test whether an item is in a array 151 | 152 | • Test whether an item is not in a array 153 | 154 | 155 | 25. Alien Colors #1: Imagine an alien was just shot down in a game. Create a 156 | variable called alien_color and assign it a value of 'green', 'yellow', or 'red'. 157 | 158 | • Write an if statement to test whether the alien’s color is green. If it is, print 159 | a message that the player just earned 5 points. 160 | 161 | • Write one version of this program that passes the if test and another that 162 | fails. (The version that fails will have no output.) 163 | 164 | 26. Alien Colors #2: Choose a color for an alien as you did in Exercise 25, and 165 | write an if-else chain. 166 | 167 | • If the alien’s color is green, print a statement that the player just earned 5 points for shooting the alien. 168 | 169 | • If the alien’s color isn’t green, print a statement that the player just earned 10 points. 170 | 171 | • Write one version of this program that runs the if block and another that runs the else block. 172 | 173 | 174 | 27. Alien Colors #3: Turn your if-else chain from Exercise 5-4 into an if-else chain. 175 | 176 | • If the alien is green, print a message that the player earned 5 points. 177 | 178 | • If the alien is yellow, print a message that the player earned 10 points. 179 | 180 | • If the alien is red, print a message that the player earned 15 points. 181 | 182 | • Write three versions of this program, making sure each message is printed for the appropriate color alien. 183 | 184 | 28. Stages of Life: Write an if-else chain that determines a person’s stage of life. Set a value for the variable age, and then: 185 | 186 | • If the person is less than 2 years old, print a message that the person is a baby. 187 | 188 | • If the person is at least 2 years old but less than 4, print a message that the person is a toddler. 189 | 190 | • If the person is at least 4 years old but less than 13, print a message that the person is a kid. 191 | 192 | • If the person is at least 13 years old but less than 20, print a message that the person is a teenager. 193 | 194 | • If the person is at least 20 years old but less than 65, print a message that the person is an adult. 195 | 196 | • If the person is age 65 or older, print a message that the person is an elder. 197 | 198 | 29. Favorite Fruit: Make a array of your favorite fruits, and then write a series of independent if statements that check for certain fruits in your array. 199 | 200 | • Make a array of your three favorite fruits and call it favorite_fruits. 201 | 202 | • Write five if statements. Each should check whether a certain kind of fruit is in your array. If the fruit is in your array, the if block should print a statement, 203 | such as You really like bananas! 204 | 205 | 206 | 30. Hello Admin: Make a array of five or more usernames, including the name 'admin'. Imagine you are writing code that will print a greeting to each user 207 | after they log in to a website. Loop through the array, and print a greeting to each user: 208 | 209 | • If the username is 'admin', print a special greeting, such as Hello admin, would you like to see a status report? 210 | 211 | • Otherwise, print a generic greeting, such as Hello Eric, thank you for logging in again. 212 | 213 | 31. No Users: Add an if test to Exercise 28 to make sure the list of users is not empty. 214 | 215 | • If the list is empty, print the message We need to find some users! 216 | 217 | • Remove all of the usernames from your array, and make sure the correct message is printed. 218 | 219 | 32. Checking Usernames: Do the following to create a program that simulates how websites ensure that everyone has a unique username. 220 | 221 | • Make a list of five or more usernames called current_users. 222 | 223 | • Make another list of five usernames called new_users. Make sure one or two of the new usernames are also in the current_users list. 224 | 225 | • Loop through the new_users list to see if each new username has already been used. If it has, print a message that the person will need to enter a 226 | new username. If a username has not been used, print a message saying that the username is available. 227 | 228 | • Make sure your comparison is case insensitive. If 'John' has been used, 'JOHN' should not be accepted. 229 | 230 | 33. Ordinal Numbers: Ordinal numbers indicate their position in a array, such as 1st or 2nd. Most ordinal numbers end in th, except 1, 2, and 3. 231 | 232 | • Store the numbers 1 through 9 in a array. 233 | 234 | • Loop through the array. 235 | 236 | • Use an if-else chain inside the loop to print the proper ordinal ending for each number. Your output should read "1st 2nd 3rd 4th 5th 6th 237 | 7th 8th 9th", and each result should be on a separate line. 238 | 239 | 240 | 34. Pizzas: Think of at least three kinds of your favorite pizza. Store these 241 | pizza names in a array, and then use a for loop to print the name of each pizza. 242 | 243 | • Modify your for loop to print a sentence using the name of the pizza 244 | instead of printing just the name of the pizza. For each pizza you should 245 | have one line of output containing a simple statement like I like pepperoni 246 | pizza. 247 | 248 | • Add a line at the end of your program, outside the for loop, that states 249 | how much you like pizza. The output should consist of three or more lines 250 | about the kinds of pizza you like and then an additional sentence, such as 251 | I really love pizza! 252 | 253 | 35. Animals: Think of at least three different animals that have a common characteristic. 254 | Store the names of these animals in a list, and then use a for loop to 255 | print out the name of each animal. 256 | • Modify your program to print a statement about each animal, such as 257 | A dog would make a great pet. 258 | • Add a line at the end of your program stating what these animals have in 259 | common. You could print a sentence such as Any of these animals would 260 | make a great pet! 261 | 262 | 263 | 36. T-Shirt: Write a function called make_shirt() that accepts a size and the 264 | text of a message that should be printed on the shirt. The function should print 265 | a sentence summarizing the size of the shirt and the message printed on it. 266 | Call the function. 267 | 268 | 37. Large Shirts: Modify the make_shirt() function so that shirts are large 269 | by default with a message that reads I love TypeScript. Make a large shirt and a 270 | medium shirt with the default message, and a shirt of any size with a different 271 | message. 272 | 273 | 38. Cities: Write a function called describe_city() that accepts the name of 274 | a city and its country. The function should print a simple sentence, such as 275 | Karachi is in Pakistan. Give the parameter for the country a default value. 276 | Call your function for three different cities, at least one of which is not in the 277 | default country. 278 | 279 | 39. City Names: Write a function called city_country() that takes in the name 280 | of a city and its country. The function should return a string formatted like this: 281 | 282 | "Lahore, Pakistan" 283 | 284 | Call your function with at least three city-country pairs, and print the value 285 | that’s returned. 286 | 287 | 288 | 40. Album: Write a function called make_album() that builds a Object 289 | describing a music album. The function should take in an artist name and an 290 | album title, and it should return a Object containing these two pieces of 291 | information. Use the function to make three dictionaries representing different 292 | albums. Print each return value to show that Objects are storing the 293 | album information correctly. 294 | Add an optional parameter to make_album() that allows you to store the 295 | number of tracks on an album. If the calling line includes a value for the number 296 | of tracks, add that value to the album’s Object. Make at least one new 297 | function call that includes the number of tracks on an album. 298 | 299 | 300 | 41. Magicians: Make a array of magician’s names. Pass the array to a function 301 | called show_magicians(), which prints the name of each magician in the array. 302 | 303 | 42. Great Magicians: Start with a copy of your program from Exercise 39. 304 | Write a function called make_great() that modifies the array of magicians by adding 305 | the phrase the Great to each magician’s name. Call show_magicians() to 306 | see that the list has actually been modified. 307 | 308 | 43. Unchanged Magicians: Start with your work from Exercise 40. Call the 309 | function make_great() with a copy of the array of magicians’ names. Because the 310 | original array will be unchanged, return the new array and store it in a separate array. 311 | Call show_magicians() with each array to show that you have one array of the original 312 | names and one array with the Great added to each magician’s name. 313 | 314 | 315 | 44. Sandwiches: Write a function that accepts a array of items a person wants 316 | on a sandwich. The function should have one parameter that collects as many 317 | items as the function call provides, and it should print a summary of the sandwich 318 | that is being ordered. Call the function three times, using a different number 319 | of arguments each time. 320 | 321 | 322 | 45. Cars: Write a function that stores information about a car in a Object. 323 | The function should always receive a manufacturer and a model name. It 324 | should then accept an arbitrary number of keyword arguments. Call the function 325 | with the required information and two other name-value pairs, such as a 326 | color or an optional feature. 327 | Print the Object that’s returned to make sure all the information was 328 | stored correctly. 329 | 330 | 331 | 332 | 333 | 334 | --------------------------------------------------------------------------------