├── solutions.md ├── fix_exercise_number.py ├── README.md └── exercises.md /solutions.md: -------------------------------------------------------------------------------- 1 | # ex6 Solution 2 | 3 | laptopPrice = int(input()) 4 | 5 | taxPercentage = int(input()) 6 | 7 | totalPrice = int((laptopPrice * taxPercentage / 100) + laptopPrice) 8 | 9 | print(totalPrice) 10 | 11 | 12 | 13 | # ex7 Solution 14 | 15 | numberOfYears = int(input()) 16 | 17 | totalChildren = int(input()) 18 | 19 | totalSalary = int(400 + (20 * numberOfYears) + (30 * totalChildren)) 20 | 21 | print(totalSalary) -------------------------------------------------------------------------------- /fix_exercise_number.py: -------------------------------------------------------------------------------- 1 | import fileinput 2 | counter = 1 3 | 4 | input_file = input('Please enter the name of the file you want to edit: ') 5 | 6 | # fileinput module let us do changes in the same file 7 | with fileinput.FileInput(files=input_file, inplace=True) as f: 8 | for line in f: 9 | if line.startswith('# ex.'): 10 | replace_line = line 11 | new_line = ('# ex.{}'.format(counter)) 12 | print(line.replace(replace_line, new_line)) 13 | counter += 1 14 | else: 15 | print(line.strip()) # .strip() remove the extra blank lines 16 | 17 | print('Editing {} successfully'.format(input_file)) 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Programming exercises for beginners 2 | # 3 | [These exercises are focused on absolute beginners.](exercises.md) 4 | The purpose of [these exercises](exercises.md) is to help you develop algorithmic problem solving skills from an early stage in your programming journey. 5 | 6 | ## How to do the exercises 7 | 8 | * [Click here to find the exercises](exercises.md) 9 | * Attempt the challenges in Python 10 | * If you get stuck it's ok to see the [solution](solutions.md), but it is highly recommended to attept the problems yourself first. 11 | * Try to not use the programming language MAGIC 12 | * After you done with the exercise try to attempt it another language you are learning, or if possible make a general purpose code for that problem. Ex) ratrher than explicitly adding 5 + 3 for the specific problem: the general solution can be: return a + b, where a and b satisfy the addition problem but for ALL numbers. 13 | 14 | # Contribute 15 | If you want to contribute an exercise, make sure to use the [fix_exercise_number.py script](fix_exercise_number.py) to fix the order of exercises 16 | 17 | [Solutions](solutions.md) are coming soon! 18 | 19 | # To submit a solution 20 | 21 | #### Copy your solution to your forked repo 22 | 23 | For details on how to do this, please see: [Adding a file to a repository (web)](https://help.github.com/articles/adding-a-file-to-a-repository/) or [Adding a file to a repository (command line)](https://help.github.com/articles/adding-a-file-to-a-repository-using-the-command-line/) 24 | 25 | #### Create a pull request 26 | 27 | Once your solution has been placed into your forked repo you should initiate a pull request into the main [py-study-group/beginner-friendly-programming-exercises](https://github.com/py-study-group/beginner-friendly-programming-exercises.git) so that your solution(s) or corrections can be merged. 28 | 29 | To create a pull request, please see: [Creating a pull request from a fork](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) 30 | 31 | Once your pull request has been submitted, an admin of the py-study-group will review and merge it into the [py-study-group/beginner-friendly-programming-exercises](https://github.com/py-study-group/beginner-friendly-programming-exercises) where it will be appear alongside all of the other submitted solutions. 32 | 33 | **I specially want to thank @cripcate for writing this awesome contribution guide** 34 | -------------------------------------------------------------------------------- /exercises.md: -------------------------------------------------------------------------------- 1 | # ex.1 2 | Create two variables a and b, and initially set them each to a different number. Write a program that swaps both values. 3 | 4 | * Example: a = 10, b = 20 5 | * Output: a = 20, b = 10 6 | 7 | Warning! Do not use the programming language MAGIC. After you complete the exercise feel free to do so. 8 | 9 | # ex.2 10 | It's the end of the semester and you got your grades from three classes: Geometry, Algebra, and Physics. 11 | 12 | Create a program that: 13 | 1) Reads the grades of these 3 classes (Grades range from 0 - 10) 14 | 2) Calculate the average of your grades 15 | 16 | * Example: Geometry = 6, Algebra = 7, Physics = 8 17 | * Output: average_score = 7 18 | 19 | Warning! Do not use the programming language MAGIC. After you complete the exercise feel free to do so. 20 | 21 | # ex.9 22 | The exercise is almost identical to a previous exercise with a minor change. It's the end of the semester and you got your marks from, Geometry, Algebra, Physics classes. If the average score is 7 and above print "Good job!", if the average score is between 6 and 4 print "You need to work harder!", if the average score is below 4 print "Failed, you really need to work harder!". 23 | 24 | Create a program that: 25 | * Reads the values of these 3 lessons 26 | * Calculate the average of your grades 27 | * Example: Geometry = 6, Algebra = 7, Physics = 8 28 | * Output: Your average score is 7, Good job!" 29 | 30 | Warning! Do not use the programming language magic. After you complete the exercise feel free to do so. 31 | 32 | # ex.3 33 | You've bought a Bitcoin and now it's on the rise!!! 34 | 35 | Create a program that: 36 | 1) Reads the value of the bitcoin at the time of purchase 37 | 2) Reads the percentage of increase (or decrease) 38 | 3) Prints the total value of your bitcoin 39 | 4) Prints the increase or decrease value 40 | 41 | * Example: bitcoin_value = 10000, bitcoin_increase = 10 42 | * Output: total_bitcoin_value = 11000, bitcoin_increase_value = 1000 43 | 44 | # ex.4 45 | You now own some property and you want to calculate the total area of the property. 46 | 47 | Create a program that: 48 | 1) Reads the width and height 49 | 2) Prints the area 50 | 51 | * Example: width = 5, height = 2 52 | * Output: total_area = 10 53 | 54 | # ex.5 55 | You are interested in buying crypto-currencies. You want to check the current amount of money you have and see how many coins you can buy in Bitcoin, Ethereum, and Litecoin. 56 | 57 | Create a program that: 58 | 1) Reads the total amount of money you have 59 | 2) Reads the price of Bitcoin, Ethereum, and Litecoin 60 | 3) Prints the amount of Bitcoin, Ethereum, and Litecoin you can buy 61 | 62 | * Example: money = 100, bitcoin_price = 50, ethereum_price = 25, litecoin_price = 10 63 | * Output: "With 100$ you can buy: 2 Bitcoins, 4 Ethereum, and 10 Litecoins" 64 | 65 | (Warning! Τhe prices are made up for exercise purposes) 66 | 67 | # ex.6 68 | You are interested in buying a new laptop. You check the price and you see that the price is 300$ without the 10% tax. 69 | 70 | Create a program that: 71 | 1) Reads the price of the laptop 72 | 2) Reads the tax percentage 73 | 3) Prints the total amount 74 | 75 | * Output: "The total price of the laptop is 330$" 76 | 77 | # ex.7 78 | In a company the monthly salary of an employee is calculated by: the minimum wage 400$ per month, plus 20$ multiplied by the number of years employed, plus 30$ for each child they have. 79 | 80 | Create a program that: 81 | 1) Reads the number of years employed 82 | 2) Reads the number of children the employee has 83 | 3) Prints the total amount of salary the employee makes 84 | 85 | * Output: "The total amount is 560$. 400$ minimum wage + 100$ for 5 years experience + 60$ for 2 kids" 86 | 87 | # ex.8 88 | The exercise is almost identical to a previous exercise with a minor change. In a company the monthly salary of an employee is calculated by minimum wage 400$ per month, plus 20$ multiply by the employment years, plus 30$ for each employee kid, plus 100$ if the employee didn't miss 1 day of work. 89 | 90 | Create a program that: 91 | * Reads the employment years 92 | * Reads the number of each employee kids 93 | * Prints the total amount the employee must take 94 | * Output: "The total amount is 660$, 400$ minimum wage + 100$ for 5 years experience + 60$ for 2 kids + 100$ for not missing a day at work" 95 | 96 | # ex.10 97 | Create a program that prints the last digit of a given integer 98 | 99 | Create a program that: 100 | 1) Reads the integer 101 | 2) Prints the last digit 102 | 103 | Warning! Do not use the programming language MAGIC. After you complete the exercise feel free to do so. 104 | 105 | Warning! Don't try to convert the number into string etc. 106 | 107 | Warning! For this problem it's ok after spending some time to look for the solution. 108 | 109 | # ex.11 110 | You have started working and you are wondering how many things you can buy with the money you've earned. A PS4 costs 200$, a Samsung phone 900$, a TV 500$, a game skin 9.99$ 111 | 112 | Create a program: 113 | * Notice that you can't but half TV or 1/4 of PS4. 114 | * Reads how many hours you've worked 115 | * Reads your hourly income 116 | * Prints how many items you can buy 117 | * Output: "I can buy 4 PS4, 1 Samsung, 3 TV, 80 game skin" 118 | 119 | # ex.12 120 | You've consumed X amount of Mbps on Wikipedia and Y amount of Mbps on memes. The cost of visiting Wikipedia is 0,10$ per Mb 121 | and the cost for watching memes is 0,05$ per Mb. If total consumption is more than 100$ print "Too much consumption". 122 | If watching meme consumption is greater than reading wikipedia consumption print "WOW MANY MEMES", "SUCH LOL"(in new line). 123 | 124 | Create a program that: 125 | * Reads X(wikipedia Mb consupmtion) and Y(watching meme Mb consumption) 126 | * Calculates the total consumption 127 | * If total consumption greater than 100$ print proper message 128 | * If watching meme consumption is greater than reading wikipedia articles print proper messages 129 | 130 | Warning! For the greater meme consumption you will use one print statement and the output must be in seperate lines 131 | 132 | # ex.13 133 | An internet cafe has 2 ways of charging. If the user is a member pays 2$/hour, Else the user pays 5$. Find if someone is a member or not and calculate the price based on how many hours the user spend. If the user is a member the tax is 10% else the tax is 20%. 134 | 135 | Create a program that: 136 | * Reads how many hours the user spend 137 | * Check if is a member 138 | * Add the proper tax fee 139 | * Print the total amount the user has to pay 140 | * Output: "The user is a member stayed 2 hours for 2$/hour plus the 10% the total amount is 4.4$" 141 | 142 | # ex.14 143 | You want to buy something from Amazon. The seller charges different prices for shipping cost based on location. For US it's 5$ for Europe it's 7$ for Canada it's 3$ for other places it's 9$ 144 | 145 | Create a program that: 146 | * Reads the cost of the product 147 | * Reads your location 148 | * Print the amount of money you have to pay 149 | * Ouput: "You have to pay 23$, 20$ for the product and 3$ for shipping cost" 150 | 151 | # ex.15 152 | A cell phone company has the following billing policy 153 | 154 | | | Fixed cost 25$ | 155 | |---------|--------------| 156 | | Call duration(in seconds)| Charge($/per second)| 157 | | 1-500 | 0,01 | 158 | | 501-800 | 0,008 | 159 | | 801+ | 0,005 | 160 | 161 | Create a program that: 162 | * Reads how many seconds was the calls duration 163 | * Calculates the monthly bill for the subscriber 164 | * Prints the total amount 165 | * Output: "total amount: 48$" 166 | 167 | #### Notice that that the charge for the first 500 seconds it's 0,01$ then for the next 501 to 800 seconds it's 0,008 and then it's 0,005$ 168 | 169 | # ex.16 170 | A fast food chain has these meals 171 | 172 | | Meal | Price | 173 | |---------|--------------| 174 | | Burger | 5$ | 175 | | Pizza | 3$ | 176 | | Hot Dog | 1,5$ | 177 | 178 | Create a program that: 179 | * Reads the meal the customer wants 180 | * Prints the cost of the meal 181 | * Input example: "Hot Dog" 182 | * Output: "Hot Dog 1,50$" 183 | 184 | # ex.17 185 | Create a program that: 186 | * Calculates the sum of 1+2+3+4...+98+99 187 | * Prints the sum of 1+2+3+4...+98+99 188 | * Output: "The sum is 4950" 189 | 190 | # ex.18 191 | * Calculates the sum of 1+3+5+7...+99+101 192 | * Prints the sum of 1+3+5+7...+99+101 193 | * Output: "The sum is 2601" 194 | 195 | # ex.19 196 | Create a program that reads a number that you want to get the sum until that number 197 | 198 | Create a program that: 199 | * Reads the number you want to sum 200 | * Calculates the sum of 1+2+3+4...+98+99+n 201 | * Prints the sum of 1+2+3+4...+98+99+n 202 | * Input example: 100 203 | * Output: "The sum is 5050" 204 | 205 | ###### Try the program with a very very big number, [if it takes too long check this out](http://mathcentral.uregina.ca/qq/database/qq.02.06/jo1.html) 206 | 207 | # ex.20 208 | Create a program that reads a number that you want to get the sum until that number and then calculate the averge of these numbers 209 | 210 | Create a program that: 211 | * Reads the number you want to sum 212 | * Calculates the sum of 1+2+3+4...+98+99+n 213 | * Calculates the average of the sum 1+2+3+4...+98+99+n 214 | * Input example: 100 215 | * Output: "The average is 50.5" 216 | 217 | # ex.21 218 | Create a program that reads 5 numbers and find the average of these numbers 219 | 220 | Create a program that: 221 | * Reads the 5 numbers you want 222 | * Calculates the average of these numbers 223 | * Input example: 4, 6, 1, 4, 9 224 | * Ouput: "the average is 4.8" 225 | 226 | # ex.22 227 | Create a program that reads 5 numbers and prints if the number is negative or positive 228 | 229 | Create a program that: 230 | * Reads the 5 numbers you want 231 | * Print if a number is negative or positive 232 | * Input example: 4, 6, -11, -4, 9 233 | * Ouput: "Positive", "Positive", "Negative", "Negative", "Positive", 234 | 235 | # ex.23 236 | Create a program that reads numbers and sum them until the user inputs a negative value 237 | 238 | Create a program that: 239 | * Reads numbers 240 | * Sum them 241 | * Prints the sum 242 | * Input example: 5, 9, 3, 0, 2, 0, 4, -7 243 | * Output: "The sum is 23" 244 | 245 | # ex.24 246 | Create a program that reads numbers and sum them until the user inputs a negative value or zero value 247 | 248 | Create a program that: 249 | * Reads numbers 250 | * Sum them 251 | * Prints the sum 252 | * Input example: 5, 9, 3, 7, 0 253 | * Output: "The sum is 24" 254 | 255 | # ex.25 256 | You start flipping a coin, count and print how many times the result was head or tails until you enter the word "stop". Then find and print the percentage of how many head or tails was the result. 257 | 258 | Create a program that: 259 | * Reads if the flipped coin was head or tails 260 | * If the value is "stop", print proper message and quit program 261 | * While value not "stop", count the result 262 | * Print the proper message 263 | * Calculates the percentage of head and tails 264 | * Prints the proper message 265 | * Input: "head", "tails", "tails", "tails", "head", "head", "tails", "tails", "tails", "head" 266 | * Ouput: "Head won 4 times and tails won 6 times" 267 | * Output: "40% Head, 60% Tails" 268 | 269 | # ex.26 270 | Create a program that read values of apartments you want to rent until the inpute value is 0 or a negative number. 271 | 272 | You will calculate the average price for rent and how many apartments you've registered. Print the proper message. 273 | 274 | Then compare values of apartments you want to rent with the avarage price of the apartments you've registered until you enter 0 or a negative value. 275 | 276 | If the price is above average price print the proper message, else if the price is below average print the proper message. If the input value is 0 or a negative number, print the proper message and exit. 277 | 278 | Create a program that: 279 | * Reads values until user inputs 0 or a negative value 280 | * Calculates the average price 281 | * Counts how many apartments registered 282 | * Prints the average price and how many apartments registered 283 | * Reads prices and compare with the average price and print proper message 284 | * Input: 234, 764, 123, 654 285 | * Output: "4 apartments have registed. The average price for rent is 443.75$" 286 | * Input: 500, 200, 350, 450, 0, -7 287 | * Output: "Above average price", "Above below price", "Above below price", "Above average price", "Quit Program","Quit Program" 288 | 289 | # ex.27 290 | Create a program that register a user with a username and a password. Then the user will try to login with the login credentials. If the user make 3 wrong attempts exit program with proper message. 291 | 292 | Create a program that: 293 | * Reads the username and the password 294 | * Then the user try to login 295 | * If the user makes 3 wrong attempts exit with proper message 296 | 297 | # ex.28 298 | Create a program that asks the user for seconds(integers values) and then start printing the countdown, when the countdown ends print Go!. If the user enters a non integer value, exit the program with proper message. 299 | 300 | Create a program that: 301 | * Reads integers until user enters a non integer value. 302 | * Print the countdown and at the end print Go! 303 | * Input: 3, -7 304 | * Output: 3, 2, 1, Go! - Exit Program 305 | 306 | # ex.29 307 | A Park Garage company asked you to create a program that asks if the driver is a member and then charge the driver with 1,5$ fixed cost, if the driver is not a member the fixed cost is 3$. Make sure to keep asking if the driver enters the proper response 308 | 309 | Then asks the driver how many hours have parked. For the 1st hour the cost is 2$, for the 2nd hour the price is 1,5$ for the 3rd hour the price is 1$. From the 4th hour and after the cost is 0.5$ per hour. Make sure to keep asking the driver enters a valid value. 310 | 311 | Finds the cost the driver has to pay and print it. Ask the user to continue the program or not. 312 | 313 | On exit Counts and print how many drivers payed and the total amount of earnings. Ask the user to continue the program or not. 314 | 315 | Create a program that: 316 | * Reads if the driver is a member or not 317 | * Check if the driver entered the proper response 318 | * Charge the driver with the proper fixed cost 319 | * Asks the driver how many hours have parked 320 | * Check if the driver entered the proper value 321 | * Finds how many drivers payed and the total amount of earnings 322 | * Input: Yes(Driver is member), 6(Hours has parked), No(exit program) 323 | * Output: "Total amount is 7,5$" 324 | * Output: "1 Driver payed. The total earnings are 7,5$" 325 | 326 | # ex.30 327 | A company asked you to create a program that reads an employee name and salary and store them into proper lists.The number of employees is unknown. To exit the program the user must input "quit". Before the exit find the employees with the maximum salary and print who they are. 328 | 329 | Create a program that: 330 | * Reads employee name and salary, store them into different lists 331 | * Asks the user to continue 332 | * If the user wants to exit the program find and print the employees with maximum salary 333 | * Input: [Mary, John, George, Nicole], [2343, 2134, 5342, 5342] 334 | * Output: George - 5342, Nicole - 5432 335 | 336 | #### Notice that we have to find the maximum salary and then compare the salaries in case someone has the exactly same salary with someone else. 337 | 338 | # ex.31 339 | The previous exercise but store the names and salaries into one list. 340 | 341 | * Input : [Mary, 2343 John, 2134, George, 5342, Nicole, 5342] 342 | * Output: George - 5342, Nicole - 5432 343 | 344 | #### Notice that if the programming language you are using doesn't support different kind of values in lists try to store the numbers as characters and convert to numbers when you want to compare 345 | 346 | # ex.32 347 | you have a list with domain names and an other list with domain extension. also possible combinations. 348 | 349 | # ex.33 350 | A company asked you to create a program that reads an employee name and salary and store them into proper lists.The number of employees is unknown. To exit the program the user must input "quit". Before the exit find and print the total number of employees and the total amount company is paying in salaries. 351 | 352 | Create a program that: 353 | * Reads employee name and salary, store them into different lists 354 | * Asks the user to continue 355 | * If the user wants to exit the program find and print the total number of employees and total amount of salaries 356 | * Input: [Mary, John, George, Nicole], [2343, 2134, 5342, 5342] 357 | * Output: "4 employees and the total amount of salaries is 15161$" 358 | 359 | # ex.34 360 | A company asked you to create a program that reads an employee name and salary and store them into proper lists.The number of employees is unknown. To exit the program the user must input "quit". Before exit find the average salary and for each employee print if their salary is above or below average salary. 361 | 362 | Create a program that: 363 | * Reads employee name and salary, store them into different lists 364 | * Asks the user to continue 365 | * If the user wants to exit the program find the average salary and for each employee print if is above or below average salary 366 | * Input: [Mary, John, George, Nicole], [2343, 2134, 5342, 5342] 367 | * Output: "The average salary is 3790.25$", "Mary's salary is below average","John's salary is below average","George's salary is above average","Nicole's salary is above average" 368 | 369 | # ex.35 370 | A company asked you to create a program that reads an employee name and salary and store them into proper lists.The number of employees is unknown. To exit the program the user must input "quit". Before exit find the average salary and for each employee print if their salary is above or below average salary. If the employee have above average salary then remove the employee from the list. 371 | 372 | Create a program that: 373 | * Reads employee name and salary, store them into different lists 374 | * Asks the user to continue 375 | * If the user wants to exit the program find the average salary and for each employee print if is above or below average salary 376 | * Input: [Mary, John, George, Nicole], [2343, 2134, 5342, 5342] 377 | * Output: "The average salary is 3790.25$", "Mary's salary is below average","John's salary is below average","George's salary is above average","Nicole's salary is above average" 378 | * Output: "Total Employees: 2" 379 | 380 | # ex.36 381 | A company asked you to create a program that reads an employee name and salary and store them into proper lists.The number of employees is unknown. To exit the program the user must input "quit". Before exit find the average salary and for each employee print if their salary is above or below average salary. If the employee have above average salary then remove the employee from the list and put the employee in to a new list. Print the total number of current employees and removed emloyees 382 | 383 | Create a program that: 384 | * Reads employee name and salary, store them into different lists 385 | * Asks the user to continue 386 | * If the user wants to exit the program finds the average salary and for each employee print if is above or below average salary 387 | * Removes the employee from the list if the salary is above average 388 | * Prints the total number of current employees and removed emloyees 389 | * Input: [Mary, John, George, Nicole], [2343, 2134, 5342, 5342] 390 | * Output: "The average salary is 3790.25$", "Mary's salary is below average","John's salary is below average","George's salary is above average","Nicole's salary is above average" 391 | * Output: "Total Employees: 2", "Removed Employees: 2" 392 | 393 | # ex.37 394 | You have these lists of empoyees and their salaries: names[Mary, John, George, Nicole, Nick, Jim, Jack, Johanna], salaries[32343, 12134, 25342, 35342, 42343, 32134, 15342, 25342] 395 | 396 | Create a program that: 397 | * Orders the salaries by biggest salary first 398 | * Prints all employees in order by lowest salary first 399 | * Output: "later when I run the script" 400 | 401 | # ex.38 402 | Create a program that stores all [Morse Code](https://en.wikipedia.org/wiki/Morse_code) into a dictionary. Then 403 | asks the user for an input text and translate to Morse Code. 404 | 405 | Create a program that: 406 | * Stores all Morse Code values into a dictionary 407 | * Asks the user for text 408 | * Prints the tranlsation of Morse Code 409 | * Input example: "Python Rocks" 410 | * Output example: ".--. -.-- - .... --- -. / .-. --- -.-. -.- ..." 411 | 412 | # ex.39 413 | Create a program that asks if the user want to translate a text **from Morse Code** or **to Morse Code** 414 | 415 | #### [Here you can find online Morse Code translator](https://morsecode.scphillips.com/translator.html) 416 | 417 | # ex.40 418 | Here is [Nato Phonetic Alphabet](https://en.wikipedia.org/wiki/NATO_phonetic_alphabet). Create a program that stores the all the abrevations into a dictionary. Next asks the user for a word and then print the right words for each letter of the given word 419 | 420 | Create a program that: 421 | * Stores the words for each letter 422 | * Then asks the user for a word 423 | * Prints the right words 424 | * Input example: "Python" 425 | * Output example: "Papa, Yankee, Tango, Hotel, Oscar, November" 426 | 427 | #### [Here you can find Nato Phonetic Alphabet](https://en.wikipedia.org/wiki/NATO_phonetic_alphabet) 428 | 429 | # ex.41 430 | Create a program that asks if the user want to translate a text **from Nato Phonetic Alphabet** or **to Nato Phonetic Alphabet** 431 | 432 | # ex.42 433 | A user account on a website is composed by a username, a password, if the user has profile picture, and the email. 434 | 435 | Create a program: 436 | * That reads the username, password, if the user has uploaded photo or not(boolean value), and the email. 437 | * Stores the values into a dictionary based on username 438 | * Input: iakovosbelonias, 123, Yes, iakovosbelonias@gmail.com 439 | * Output: {'iakovosbelonias': {'password': 123, 'hasPhoto': True, 'email': 'iakovosbelonias@gmail.com'}} 440 | 441 | #### Notice that the structure is like this users[username] = {'password': password, 'hasPhoto': hasPhoto, 'email': email}, word not in quotes are variables. 442 | 443 | # ex.43 444 | A user account on a website is composed by a username, a password, if the user has profile picture, and the email. 445 | 446 | Create a program: 447 | * That reads the username, password, if the user has uploaded photo or not(boolean value), and the email. 448 | * If the email is already in the dictionary warns the user and asks again until get a valid email 449 | * Stores the values into a dictionary based on username 450 | * Input: iakovosbelonias, 123, Yes, iakovosbelonias@gmail.com 451 | * Output: {'iakovosbelonias': {'password': 123, 'hasPhoto': True, 'email': 'iakovosbelonias@gmail.com'}} 452 | 453 | #### Notice that the structure is like this users[username] = {'password': password, 'hasPhoto': hasPhoto, 'email': email}, word not in quotes are variables. 454 | 455 | # ex.44 456 | A user account on a website is composed by a username, a password, if the user has profile picture, and the email. 457 | 458 | Create a program: 459 | * That reads the username, password, if the user has uploaded photo or not(boolean value), and the email. 460 | * The password must be between 6 and 12 digits. Asks the user until gets a valid password 461 | * Stores the values into a dictionary based on username 462 | * Input: iakovosbelonias, 123, Yes, iakovosbelonias@gmail.com 463 | * Output: {'iakovosbelonias': {'password': 123, 'hasPhoto': True, 'email': 'iakovosbelonias@gmail.com'}} 464 | 465 | #### Notice that the structure is like this users[username] = {'password': password, 'hasPhoto': hasPhoto, 'email': email}, word not in quotes are variables. 466 | 467 | # ex.45 468 | A user account on a company's website is composed by a username, a password, salary, and the email. 469 | A company asks you to create a program that create a user, ask for username,password,salary, email and check if the username or email already exists. 470 | 471 | Create a program: 472 | * Try to find on your own what the company needs 473 | * Test your program with various inputs 474 | * Print all the users 475 | 476 | 477 | # ex.46 478 | start creating users until user enter stop. check if username and email exist. check password. create user. ask user if he/she wants to delete a specific user by email or username then proceed and delete the user 479 | 480 | 481 | # ex.47 482 | bank has users. users info are name, id, balance. Create users and ask for id number and balance. 483 | 484 | # ex.48 485 | bank has users. users info are name, id, balance. Create, read info(id, balance), check if user already exists. if user has 0 balance, delete account. 486 | 487 | # ex.49 488 | bank has users. users info are name, id, balance. Create, read info(id, balance), check if user already exists. if user has 0 balance, copy to a new list , delete account from active list. 489 | 490 | # ex.50 491 | bank users, info balance everything provided. Ask program for options. create user(check if user exit) if update user id(check if exist) balance(check not to be negative), if result = 0(warning! might deactivate the account, are you sure you want to procceed?)---(if no, ask for new amount ot leave). name etc. 492 | 493 | # ex.51 494 | You have two lists. The first list has the names of 5 employees and the second list has their salary. Create a dictionary with the names as key and salaries as value. 495 | 496 | # ex.52 497 | You have three lists. The first list has the names of 5 employees, the second list has their salary and the third list has how many days each employee missed. Create a dictionary with the employee name as key, salary and days missed for each employee as value 498 | 499 | # ex.53 500 | From the previous exercise find the employee with the fewest days missing. 501 | 502 | # ex.54 503 | From the previous exercise find the employee with the fewest days missing and lowest salary and give the employee a raise of 10% 504 | --------------------------------------------------------------------------------