Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Calculate the sum of 10.8, 12.2 and 0.2, store it in the variable total, then display total's value. 2. Evaluate the expressions 4**3**2,
- 1. Calculate the sum of 10.8, 12.2 and 0.2, store it in the variable total, then display total's value.
- 2. Evaluate the expressions 4**3**2, (4**3)**2 and 4**(3**2). Are any of the parentheses redundant?
- 3. Use float to convert '6.2' (a string) to a floating-point value. Multiply the value by 3.3 and show the answers
- 4.For the value 47, 95, 88, 73 and 84 calculate the minimum and maximum.
- 5. Write a Python program to calculate a dog's age in a dog's years. Note: For the first two years, a dog year is equal to 10.5 human years. After that, each dog year equals 4 human years. Expected Output:
- Input a dog's age in human years: 15
The dog's age in dog's years is 73 - 6.Write a Python program to find the median of three values. Expected Output:
- Input first number: 15
Input second number: 26
Input third number: 29
The median is 26.0 - 7.Write a Pandas program to select the rows the score is between 15 and 20 (inclusive). Sample Python dictionary data and list labels:
exam_data = {'name': ['Anastasia', 'Dima', 'Katherine', 'James', 'Emily', 'Michael', 'Matthew', 'Laura', 'Kevin', 'Jonas'], 'score': [12.5, 9, 16.5, np.nan, 9, 20, 14.5, np.nan, 8, 19],
'attempts': [1, 3, 2, 3, 2, 3, 1, 1, 2, 1],
'qualify': ['yes', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes']}
labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
Expected Output:
Rows where score between 15 and 20 (inclusive):
attempts name qualify score
c 2 Katherine yes 16.5
f 3 Michael yes 20.0
j 1 Jonas yes 19.0 - 8.Write a Pandas program to calculate the sum of the examination attempts by the students.
- Sample DataFrame: exam_data = {'name': ['Anastasia', 'Dima', 'Katherine', 'James', 'Emily', 'Michael', 'Matthew', 'Laura', 'Kevin', 'Jonas'], 'score': [12.5, 9, 16.5, np.nan, 9, 20, 14.5, np.nan, 8, 19], 'attempts': [1, 3, 2, 3, 2, 3, 1, 1, 2, 1], 'qualify': ['yes', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes']} labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
- 9.Write a Pandas program to sort the data frame first by 'name' in descending order, then by 'score' in ascending order.
- Sample DataFrame: exam_data = {'name': ['Anastasia', 'Dima', 'Katherine', 'James', 'Emily', 'Michael', 'Matthew', 'Laura', 'Kevin', 'Jonas'], 'score': [12.5, 9, 16.5, np.nan, 9, 20, 14.5, np.nan, 8, 19], 'attempts': [1, 3, 2, 3, 2, 3, 1, 1, 2, 1], 'qualify': ['yes', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes']} labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] Values for each column will be: name : 'Suresh', score: 15.5, attempts: 1, qualify: 'yes', label: 'k'
- 10.Write a Python program to create the multiplication table (from 1 to 10) of a number. Expected Output:
- Input a number: 6
6 x 1 = 6
6 x 2 = 12
6 x 3 = 18
6 x 4 = 24
6 x 5 = 30
6 x 6 = 36
6 x 7 = 42
6 x 8 = 48
6 x 9 = 54
6 x 10 = 60
Step by Step Solution
★★★★★
3.27 Rating (147 Votes )
There are 3 Steps involved in it
Step: 1
Below are the python programs 1 total 108 122 02 print...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started