- Print out “This is python class”
- Print out the remainder of 97 divided by 24
- Print out the result of 4 power 6
- The price of apple is 8, you have cash 100, you want to buy two apples, calculate the money you have(calculate it with variables total, apple, remain)
- make an introduction
example:
name = …
age = …
gender = …
hobby = …
print out the result using variable. The string will look like this:
my name is xxx, I am xx years old, I am a xxx(gender), I like xxx(hobby) - make an introduction with input().
- create a list with your favorite singers,
then append it, insert it, pop it, take out the value where the index is 1 - create a dictionary where key is everybody’s name in this class, value is gender.
Then take out the value where the key is your name - create two sets s1 = {1, 2, 3, 6, 7, 9}, s2 = {3, 4, 7, 8, 10}, print out s1 & s2, s1 | s2
- Bob's height is 1.75m, his weight is 80.5kg, calculate Bob's BMI(weight / (height * height), using 'if elif' print out the result
below 18.5:too light
18.5-25:normal
25-28:fat
28-32:too fat
32:super fat - using for loop to print out 'Hello, xxx!':L = ['Bart', 'Lisa', 'Adam']
- define a function called quadratic(a, b, c), return answers of ax2 + bx + c = 0 (hint: use math.sqrt())
- Hanoi
- Yanghui Triangle:
<pre>
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
</pre>
consider every row as a list, using generator to print it out
- using map() function to transfer username into formatted name
input:['adam', 'LISA', 'barT']
output:['Adam', 'Lisa', 'Bart']: - create a function to calculate the production of each number in the list.
input:[1, 2, 3, 4]
output: 24
hint:using reduce() - filter the palindrome number(123454321)