|
1 | | -# Python Basics - Assignment |
| 1 | +# Python Assignments and solution |
2 | 2 |
|
3 | 3 | In this Github repository, I have solved some basic python assignmnet problems during the couse of my data science. |
4 | | - |
5 | | -Problems: |
6 | | -1. Simple Message: Store a message in a variable, and then print that message. |
7 | | -2. Store a message in a variable and print that message. Then change the |
8 | | -value of your variable to a new message and print the new message. |
9 | | -3. Store a person’s name in a variable and print a message to that person. |
10 | | -Your message should be simple, such as, “Hello Eric, would you like to |
11 | | -learn some Python today?” |
12 | | -4. Find a quote from a famous person you admire. Print the quote and the |
13 | | -name of its author. Your output should look something like the following, |
14 | | -including the quotation marks: Albert Einstein once said, “A person who |
15 | | -never made a mistake never tried anything new.” |
16 | | -5. Repeat Exercise 4, but this time store the famous person’s name in a |
17 | | -variable called famous_person. Then compose your message and store it in |
18 | | -a new variable called message. Print your message. |
19 | | -6. Write addition, subtraction, multiplication, and division operations that |
20 | | -each result in the number 8. Be sure to enclose your operations in print |
21 | | -statements to see the results. You should create four lines that look like |
22 | | -this: print (5 + 3) |
23 | | -Your output should simply be four lines with the number 8 appearing once |
24 | | -on each line. |
25 | | -7. Store your favourite number in a variable. Then, using that variable, create |
26 | | -a message that reveals your favourite number. Print that message. |
27 | | -8. Choose two of the programs you’ve written and add at least one comment |
28 | | -to each. If you don’t have anything specific to write because your programs |
29 | | -are too simple at this point, just add your name and the current date at the |
30 | | -top of each program file. Then write one sentence describing what the |
31 | | -program does. |
32 | | -9. Store the names of a few of your friends in a list called names. Print each |
33 | | -person’s name by accessing each element in the list, one at a time. |
34 | | -10.Start with the list you used in Exercise 9, but instead of just printing each |
35 | | -person’s name, print a message to them. The text of each message should |
36 | | -be the same, but each message should be personalized with the person’s |
37 | | -name. |
38 | | -11.Think of your favourite mode of transportation, such as a motorcycle or a |
39 | | -car, and make a list that stores several examples. Use your list to print a |
40 | | -series of statements about these items, such as “I would like to own a |
41 | | -Honda motorcycle.” |
0 commit comments