Answered step by step
Verified Expert Solution
Question
1 Approved Answer
for i in range (5, 10): print(i, end=',') # Print i in range (start, stop, step) for i in range(2, 10, 2): print(i, end=', ')
for i in range (5, 10): print(i, end=',') # Print i in range (start, stop, step) for i in range(2, 10, 2): print(i, end=', ') value = input("Please enter a string: ") print(f'You entered {value) and its type is {type(value)}') value = input("Please enter an integer: ") print(f'You entered {value) and its type is {type(value)}') Start = 0 stop (n = 10) n+1 sum=0 sum=sum+num 0 1 11 n = 10 sum = 0 for num in range(0, n+1, 1): sum = sum+num 1 2 13 2. 3 16 3 4 20 For num in range (0, 10, 1) 4 5 25 5 6 31 6 7 38 7 8 46 8 9 55 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 n = 30 total_numbers = n sum=0 while (n >= 0): sum += n n-=1 print ("sum using while loop ", sum) average = sum / total_numbers print("Average using a while loop ", average)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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