Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Script Show me how to print the computation of each even number plus the odd number equal to calc to the terminal as detailed

Python Script
Show me how to print the computation of each even number plus the odd number equal to calc to the terminal as detailed below:
For example print out "2+1=3","2+3=
5","2+5=7","2+7=9","2+9=11",2+11=13","2+13=15","2+15=17","2+19=21", then "4+1=5","4+3=7", and so on for the user to see the output on screen for all the values even and odd above ending with "19+19=38".
even_sum =0
odd_sum =0
for num in range(1,20):
if num %2==0:
even_sum += num
print(f"Even: {num}")
else:
odd_sum += num
print(f"Odd: {num}")
calc = even_sum + odd_sum
print(f"Even + Odd ={calc}")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions