Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Square to the Next Level

by CodeChum Admin

We've already tried printing out the values of an array in reversed order, right? Today, we shall compute for the squares of all the numbers.


There's already a predefined array/list containing 100 integer values. Loop through each values, compute their squares, and display them.


Output

Multiple lines containing an integer.

4
9
25
10000
49
9
25
9
1
16
.
.
.

Weekends


Given two dates D1 and D2, write a program to count the number of Saturdays and Sundays from D1 to D2 (including D1 and D2).


The date in string format is like "8 Feb 2021".Input




The first line of input will contain date D1 in the string format.


The second line of input will contain date D2 in the string format.Output




The output should be a single line containing two integers separated by space.Explanation




For example, if the given dates are "25 Jan 2021" and "14 Feb 2021", the Saturdays and Sundays dates from "25 Jan 2021" to "14 Feb 2021" are


"30 Jan 2021" is a Saturday


"31 Jan 2021" is a Sunday


"6 Feb 2021" is a Saturday


"7 Feb 2021" is a Sunday


"13 Feb 2021" is a Saturday


"14 Feb 2021" is a Sunday


So the output should be


Saturday: 3


Sunday: 3


Sample Input 1


25 Jan 2021


14 Feb 2021


Sample Output 1


Saturday: 3


Sunday: 3




Write an Algorithm to input these ten values and get the average temperature for that day. if the average temperature value is in between 970 Fahrenheit and 990 Fahrenheit then display the message “Your body temperature is normal…”. If it is more than 100.40 Fahrenheit then display the message “You have a fever caused by an infection or illness…”


Write a Python program to check whether a given date is valid date or not and to out put the following.

• If the date is valid then the message “Date is Valid” otherwise the message “Date is Invalid”.

• If the date is a valid date, then the next date.


Hint:


Follow the following steps. (NOTE: You are not allowed to use any Python built-in functions.)

• Get the inputs Year, Month, and Date separately.

• Use selection statements, i.e., if-else statements to check if the Date, Month, and the Year are valid.

• if the date is a valid date, then print the next date (Increment the date).


Sample Test Cases:

Enter the Date Expected Result Next Date

Test Case 1 2020 02 30 Date is Invalid -

Test Case 2 2020 02 29 Date is Valid 01-03-2021

Test Case 3 2021 09 31 Date is Invalid -

Test Case 4 2021 13 01 Date is Invalid -

Test Case 5 2021 08 31 Date is Valid 01-09-2021


01.Write a Python program to check whether a given date is valid date or not and to out put the following.


• If the date is valid then the message “Date is Valid” otherwise the message “Date is Invalid”.

• If the date is a valid date, then the next date.


Hint:


Follow the following steps. (NOTE: You are not allowed to use any Python built-in functions.)


• Get the inputs Year, Month, and Date separately.

• Use selection statements, i.e., if-else statements to check if the Date, Month, and the Year are valid.

• if the date is a valid date, then print the next date (Increment the date).


Sample Test Cases:


Enter the Date Expected Result Next Date

Test Case 1 2020 02 30 Date is Invalid -

Test Case 2 2020 02 29 Date is Valid 01-03-2021

Test Case 3 2021 09 31 Date is Invalid -

Test Case 4 2021 13 01 Date is Invalid -

Test Case 5 2021 08 31 Date is Valid 01-09-2021


With the help panda library create a dataframe using the concept of dictionary of lists where Keys and Values of dictionary take the data as mention above in the figure and perform the following operations a) Print All columns name from the dataframe and change the b) Display top 7 and bottom 7 rows of first 3 and last 3 columns c) Write the python code statement to print the value “21-Jan-12” from dataframe. d) Write the python code statement to print the values 2nd,4th ,6th , 8th and 10th row for the column “No of Hours” e) Display the total sum of column total_payout.


Discuss different ways of creating a dataframe in python programming languages using panda library. Justify your answer with the help of suitable example


Create a dataframe by using the dataset [tipsnew.csv] and perform the following operations a) Print the day value when the value of total_bill is maximum and minimum. b) Retrieve all the rows from dataframe when the value of tip is more than 3.0 and less than 5.0 c) Print the time of the meal and gender of the person who paid the tip more than 5.0 d) Select and display last 10 rows from the dataframe when customer smoking habbit is ‘yes’ e) Create the newdataframe(ndf) from original dataframe(df) containing all rows and the following columns [total_bill tip, size]. Sort and display all values of column tip in ascendending order.


Write a Python program to check whether a given date is valid date or not and to out put the following.

• If the date is valid then the message “Date is Valid” otherwise the message “Date is Invalid”.

• If the date is a valid date, then the next date.


Hint:


Follow the following steps. (NOTE: You are not allowed to use any Python built-in functions.)

• Get the inputs Year, Month, and Date separately.

• Use selection statements, i.e., if-else statements to check if the Date, Month, and the Year are valid.

• if the date is a valid date, then print the next date (Increment the date).


Sample Test Cases:


Enter the Date Expected Result Next Date

Test Case 1 2020 02 30 Date is Invalid -

Test Case 2 2020 02 29 Date is Valid 01-03-2021

Test Case 3 2021 09 31 Date is Invalid -

Test Case 4 2021 13 01 Date is Invalid -

Test Case 5 2021 08 31 Date is Valid 01-09-2021


Assume in a video game, there are three agents named Rage, Jett, and Sage. Each of these agents has three normal skills along with an ultimate skill. Each of these skills have a damage score. To calculate the additive of this score, you need to use the following formula. additive_damage_score = sum of the Normal Skill Damage + Ultimate skill damage Now, write a Python program that will detect the agent’s name using “additive_damage_score” the from a given dictionary where the keys are "Normal Skills", "Ultimate Skill" and the values are the damages due to the use of those skills on the opponents. • If the additive damage score is less than or equal to 70, then the agent’s name is “Rage”. • If the additive damage score is greater than 70 and less than or equal to 100, then the agent’s name is “Jett”. • Otherwise, the agent’s name is “Sage”.


LATEST TUTORIALS
APPROVED BY CLIENTS