8.n=int(input()) print("the first",n,"natural numbers:") b=[ ] for i in range(n): b.append(i+1) print(b) sum=0 for i in b: sum=sum+i print("sum:",sum) Output: 7 the first 7 natural numbers: [1,2,3,4,5,6,7} sum:28
instead of multiplying i by i*i*i u can just manipulate it as Num = (i**3) here ** refers to the power exponential factor which would take any num in its right side to the power of the value in its left side then I**3 wiud be cube of the number i
7Q a=[ ] Print ("enter the number ") For i in range(5): num=(int(input("enter num"+str(i+1))) a. append(num) Print(a) Sum=0 for i in a: Sum =sum + i Ave=sum/5 Print (sum) Print (ave) Output: 15 30.0
a=[] print("enter the number ") for i in range(5): num=(int(input("enter num"+str(i+1)))) a.append(num) print(a) sum=0 for i in a: sum =sum + i ave=sum/5 print(sum) print(ave)
one small differentiation: In python while using comma , separator in print statement for concatenate it automatically converts integer to a string so we don't need to specify str(i). Directly you can mention ,i a = int(input("test data: ")) for i in range(1, a + 1): print("Number is", i, "and cube of the number", i, "is", i**3) If we use '+" concatenate for converting integer to string, we need to specify str(i) a = int(input("test data: ")) for i in range(1, a + 1): print("Number is " + str(i) + " and cube of the number " + str(i) + " is " + str(i**3)) output: test data: 5 Number is 1 and cube of the number 1 is 1 Number is 2 and cube of the number 2 is 8 Number is 3 and cube of the number 3 is 27 Number is 4 and cube of the number 4 is 64 Number is 5 and cube of the number 5 is 125
7th question answer: n = int(input()) sum = 0 print("The first",n,"Natural numbers are:") for i in range(1,n+1): print(i) sum = sum + i print("The sum of",n,"Natural numbers are:",sum)
a =[] sum=0 print("please Enter 5 subject mark :") for i in range(1,6): number =int(input("Enter the mark subject" +str(i) +": ")) a.append(number) sum =sum+number ave =sum/i
print("Your number list" ,a) print("The total :",sum) print("The Average :",ave,"%") if(ave
7th question number = int(input("Enter a number :")) natural_numbers = ' ' sum_numbers = 0 for i in range(1, number + 1): sum_numbers = sum_numbers + i natural_numbers = natural_numbers + str(i) + ' ' print(f"The first {number} Natural numbers are : {natural_numbers}") print(f"The sum of {number} is : {sum_numbers}")
7Q: a=[] for i in range (5): num=int(input ("Enter a number:")) a.append(num) sum=sum(a) len=len(a) avg=(sum/len) print(a) print("sum of a is",sum) print("average of a is",avg)
Bro instead of using the term (i*i*i) for getting cube of the respective I value....we can use the term (i**3)....this can reduce the length of the code and also it's time saving....try this method guys!
for I in range(1,6): num=i*i*i print("Number is:" +str(i),"and cube of the" +str(i),"is:",num) Output Number is: 1 and cube of the 1 is:1 Number is: 2 and cube of the 2 is:8 Number is: 3 and cube of the 3 is:27 Number is: 4 and cube of the 4 is:64 Number is: 5 and cube of the 5 is:125
this one is using list : #same 7th question using list (get 10 numbers from user as input and find sum and avg) #this time using list sum = 0 count = 0 a=[] for i in range(0,5): ele = int(input(f"enter the number {count+1}: ")) a.append(ele) count = count + 1 sum = sum + ele average = sum/count print(a) print(sum) print(average)
Question no 7. addition=0 count=0 for i in range(1,11): num=int(input()) addition=addition+num count=count+1 avg=addition/count print(addition) print(avg)
Question 8 n = int(input("Enter the number of terms: ")) numbers = [] for i in range(1, n+1): numbers.append(i) print(i, end=" ") sum=0 for i in numbers: sum=sum+i print(" The sum of the first", n, "natural numbers is:",sum) 31:23
Q8 a=[] n=int(input("Enter num:")) for i in range(1,n+1): a.append(i) print(f"The First {n} Natural Number is:{a}") sum=0 for i in a: sum=sum+i print(f"sum={sum}")
here is the 7th question, hope it is correct, #question 7 : program to read 10 nos from keyboard and find their sum and avg print ("") sum =0 count =0 max_limit = int(input ("enter the max range of the sequence: ")) max_limit = max_limit + 1 for i in range (1,max_limit): elements = int(input("enter the values to be added in the sequence: ")) count = count + 1 sum = (sum + elements) average = sum/count print(f"the sum of the sequence is {sum}") print(f"the average of the sequence is {average}")
Q8: n=int(input("Enter Number = ")) sum=0 for i in range(1,n+1): print(i) sum = sum + i print("Natural Number") print("Total Number",sum) print(sum) ANSWER: 1 2 3 4 5 6 7 NATURAL NUMBER TOTAL NUMBER 28 Q9: n=int(input("Enter Number = ")) sum=0 for i in range(1,n+1): print("The number is ",i,"the cube of the",i,"is",i**3) ANSWER: Enter Number = 5 The number is 1 the cube of the 1 is 1 The number is 2 the cube of the 2 is 8 The number is 3 the cube of the 3 is 27 The number is 4 the cube of the 4 is 64 The number is 5 the cube of the 5 is 125
8Q Ans: a=[] print("n team of natural numbers:") for I in range(1,8): b=int(input(str(I))) a.append(b) print(a) sum=0 for I in a: sum=sum+I print(sum) Ans=28
Solution for exercise 8 is cube = [] a = int(input("Enter the number 1: ")) b = int(input("Enter the number 2: ")) for i in range (a,b+1): cube.append(i) print("Cube of Number" + " " + str(i) + " " + str(i*i*i)) print(cube) entered Value: 5 output is Enter the number 1: 1 Enter the number 2: 5 Cube of Number 1 1 Cube of Number 2 8 Cube of Number 3 27 Cube of Number 4 64 Cube of Number 5 125 [1, 2, 3, 4, 5]
8th question perfect answer is: n=int(input("enter the number:")) print ("the list of natural numbers before "+str(n)+" are,") a=[ ] for i in range(1,n+1): a.append(i) print(i,end=" ") print(" ") b=sum(a) print("total sum="+str(b))
QUESTION 8: Q8. Write a program to display n terms of natural numbers and their sum CODE : a=[] sum=0 b=int(input("ENTER THE NUMBER :")) for i in range(b): sum=sum+i a.append(i+1) print(a) print("SUM OF THE NUMBERS :",sum)
Q9 a=[] n=int(input("Enter num:")) for i in range(1,n+1): a.append(i) print(f"Input Number of Terms:{n}") for i in a: print(f"Number is:{i} and cube of the {i} is:{i**i}")
output: enter the number:5 number is: 1 and cube of the 1 is : 1 number is: 2 and cube of the 2 is : 8 number is: 3 and cube of the 3 is : 27 number is: 4 and cube of the 4 is : 64 number is: 5 and cube of the 5 is : 125
solution for exercise 7 (using loop and list) list = [] b = int(input("Enter the Number: ")) for i in range(1,b+1): list.append(i) print(list) sum = 0 for i in list: sum = sum + i print(sum) output: Enter the Number: 6 [1, 2, 3, 4, 5, 6] 21
8th question: ~~~~~~~~ sum=0 print("The first 7 natural number is:") for i in range(1,8): sum=sum+i print(i) print("sum of first 7 natural number is:") print(sum) Output: ~~~~ The first 7 natural number is: 1 2 3 4 5 6 7 sum of first 7 natural number is: 28 === Code Execution Successful === ❤Thank you❤
Q.9) n=int(input("n")) for i in range(1,n+1): print("Number is:",i,"and cube of the",i,"is",i*i*i) Run(F5). Output n=5 Number is:1 and cup of the 1 is:1 Number is:2 and cup of the 2 is:8 Number is:3 and cup of the 3 is:27 Number is:4 and cup of the 4 is:64 Number is:5 and cup of the 5 is:125 ❤❤❤❤❤❤❤❤❤❤
Program for cube: for i in range(1,6): n=int(input("Enter the number:")) print("Number is :",i,"and cube of the :",i,"is",i*i*i) Expected output: Enter the number:1 Number is : 1 and cube of the : 1 is 1 Enter the number:2 Number is : 2 and cube of the : 2 is 8 Enter the number:3 Number is : 3 and cube of the : 3 is 27 Enter the number:4 Number is : 4 and cube of the : 4 is 64 Enter the number:5 Number is : 5 and cube of the : 5 is 125
8th sum: sum=0 print("The first 7 natural number is:") for i in range(1,8): sum=sum+i print(i) print("sum of first 7 natural number is:") print(sum) Output: The first 7 natural number is: 1 2 3 4 5 6 7 sum of first 7 natural number is: 28 === Code Execution Successful ===
7 . a=[] Print("Enter 10 numbers ") For in in range (10): num=int(input(f"Enter num {i+1} : ")) a.append(num) Sum=0 For i in a: Sum=sum+i Print(f"sum = {sum}") Print(f"average ={sum/10}")
8) a=[] print("The first 7 natural numbers are:") for i in range(1,8): a.append(i) print(a) sum=0 for i in a: sum=sum+i print("The sum of first 7 natural numbers are:",sum)
8Q a=int(input("Test Data: ")) b=[] for n in range(1,a+1): b.append(n) print("The first "+str(a)+" natural number is: ") for n in b: print(n) sum=0 for n in b: sum=sum+n print("Their sum="+str(sum))
You have explained if loop at your very best and it was clear, but in for loop you are bringing too much functions that we are confused to understand!!
8Q n=int(input("test data:")) Print ("the first {0} natural number is". format(n)) for i in range(1,n+1) Print(i, end=' ') Output: Test data:7 The first 7 natural number is: 1 2 3 4 5 6 7
#question8 : to find the sum of n natural nos., let me know if it can be minimalized. sum = 0 count = 0 a = [] n = int(input(f"enter the no. of digits for summing: ")) for i in range (n): count = count + 1 a.append(count) print(a) print(f"the list of natural nos. are:") for i in (a): print(i) sum = sum + i print (f"the sum value of the sequence: {sum}")
Hi EMC and Hello friends , Here I am shared the Program for Two questions : 1.Sum of First n natural number : a=int(input("Test data : ")) b=[] s=0 for i in range(0,a+1): b.append(i) print(i) s=s+i print(b) print(s) 2.Cube Problem: a=int(input("Test data :")) sum=0 for i in range(0,a+1): sum=sum+i print("Number is : "+str(i)+" and cube of the "+str(i)+" is : ",(i*i*i))
Some what I solved this I am learning too and its because of your teaching please Keep up the Good Work Brother @EMC
@@UNIQUEFASHION-mr9wl Hi Bro, Please let me know if any changes required . its worked and I got the excepted Output. please let correct me if anything wrong on the code
8 question answe program: a=int(input("Enter number:")) b=[] for i in range(a): b.append(i+1) for i in b: print("Number is:",i,"and cube of",i,"is:",i*i*i)
21:40 instead of changing i into string we can use f(literal string) to add : (colon) after number to make it easier to understand. ie... (f"enter number {i}: ")
7. a=[] sum=0 for i in range(10): num=int(input("enter num"+str(i+1)+":")) a.append(num) print(a) sum=sum+num average=sum/len(a) print(sum) print(average)
Q.8) n=int(input("n=")) a=[ ] print("The first 7 natural number is") for i in range(1,n+1): Print(i,end=" ") a.append(i) sum=0 for i in a: sum=sum+i print() print("sum") print(sum) Run(F5). Output n=7 The first 7 natural numbers is 1234567 sum 28 ❤❤❤❤❤❤❤❤❤❤
QN 7: my answer sum=0 count=0.0 avg=0 lst=[] for i in range (10): num=int(input("Enter 10 Numbers to get its sum and avg:")) lst.append(num) print(num) count+=1 print(lst) sum+=num avg=sum/count print("Sum of your numbers is:", sum) print("Avg of your numbers is:", avg)
#question 9: write a program to display the cube of the number up to an integer. , (let me know if this can be simplified, thanks.) count = 0 a = [] seq = int(input("enter the value: ")) for i in range (seq): count = count + 1 a.append(count) #print (count) print(f"the {3} root of {count} is: {pow(count,3)}")
for i in range(1,6): a=(i*i*i) print("Number is:",i,"and cube of the",i,'is:',a) ans: Number is: 1 and cube of the 1 is: 1 Number is: 2 and cube of the 2 is: 8 Number is: 3 and cube of the 3 is: 27 Number is: 4 and cube of the 4 is: 64 Number is: 5 and cube of the 5 is: 125 _____x_____
8. Write a program to display n terms of natural numbers and their sum Test Data:7 Expected output: The first 7 natural number is: 1,2,3,4,5,6,7. My ans 👇🏻:
n=int(input("Enter the number")) sum=0 for i in range (1,n+1): sum=sum+i print("The sum is:" , sum) • This is correct ✅ or wrong ❌ someone say plz... 😢😖😖.
Question 9: ----------- Write a program to display cube of the number: Test Data: Input number of terms: 5 Expected Output: ---------------- Number is 1: and cube of the 1 is:1 Number is 2: and cube of the 2 is:8 Number is 3: and cube of the 3 is:27 Number is 4: and cube of the 4 is:64 Number is 5: and cube of the 5 is:125 Solution: --------- a = int(input("Input number of terms: ")) print("Expected Output:") print("----------------") for i in range(1,6): print("Number is:",i,"and cube of the",i,"is:",i*i*i)Output: Input number of terms: 5 Expected Output: ---------------- Number is: 1 and cube of the 1 is: 1 Number is: 2 and cube of the 2 is: 8 Number is: 3 and cube of the 3 is: 27 Number is: 4 and cube of the 4 is: 64 Number is: 5 and cube of the 5 is: 125
7 question ku answer here a=[ ] c=int(input('how many number you have :')) for i in range(c): b=int(input( 'enter number '+str(i+1) +'\t:')) a.append(b) sum=0 for i in a: sum=sum+i average=(sum)/c print('result is =',average)
n=int(input("Enter the value of n:")) sum=0 print("the first",n,"natural number is:") for i in range(1,n+1): sum=sum+i print(i)
print("the sum of first",n,"natural numbers is:",sum) output: Enter the value of n:5 the first 5 natural number is: 1 2 3 4 5 the sum of first 5 natural numbers is: 15
I haven doubt in understanding forloop with list; 7,8 problem. In 7th problem how to enter or calculate average. In that video find out adding and the average.but, adding only shows in video. Gave a small tip for 8th problem
Hey bro this is your subscriber from Australia!! My programming exam is commencing on next month week -1 , I kindly request you to post some videos of def class and while loop , import modules and json file as well I’m an international student from south india
Yes bro konjam reply pannuga bro nenga two questions ha mix panni sollitinga bro ennaku cofuce ha eruku bro 🙏🙏🙏🙏 plZ reply bro na 11k pay panni veliya python basics learn panna join panna but avanga solli thadu puriyala unga video pathu tha kathukatan nenga endha video mattum konjam vera video make panni upload pannuga plZ bro 🙏🙏🙏🙏 nenga unga video va fulla watch pannuga apa tha nenga mistake pannadu ungaluku theriyum so plZ pathu konjam reply pannu bro plzzz bro 🙏🙏🙏🙏🙏🙏
8q and 9q answers correct bro? a=[] for i in range(1,8): a.append(i) Print("the first 7 natural number is:",a) sum=0 for i in a: sum=sum+i average=sum/2 Print("average:",average) Output The first 7 natural number is: [1, 2, 3, 4, 5, 6, 7] Average: 14.0 9q for i in range(1,6): print("number is:",i,"and cube of the",i,"is:",i*i*i)
#---------Q7 Answer with SUM and Average--------------- -----------------------------My Output----------------------------------- Input 10 Numbers. NUM 0: 1 NUM 1: 2 NUM 2: 3 NUM 3: 4 NUM 4: 5 NUM 5: 6 NUM 6: 7 NUM 7: 8 NUM 8: 9 NUM 9: 10 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Sum : 55 Average : 5.5 -----------------------------My Input--------------------------------------- Ten_Numbers = [ ] print("Input 10 Numbers.") sum = 0 Count = 0 Avg = 0 for Numbers in range(10): Input_Number = int(input("NUM " + str(Numbers) + ": ")) Ten_Numbers.append(Input_Number) sum = sum + Input_Number Count = Count + 1 Avg = sum / Count
print(Ten_Numbers) print("Sum :",sum) print("Average :",Avg) ------------------I hope this will help for someone 😊------------------
7 question i solved😊
a=0
For i in range(1, 11) :
num=int(input ("enter the number:"))
a=num+a
Print("the total is:", a)
Print("the average is:", a/10)
neenga kuduthathu ok but input 1,11 num illa any 10 num so above program only crt
8.n=int(input())
print("the first",n,"natural numbers:")
b=[ ]
for i in range(n):
b.append(i+1)
print(b)
sum=0
for i in b:
sum=sum+i
print("sum:",sum)
Output:
7
the first 7 natural numbers:
[1,2,3,4,5,6,7}
sum:28
😢😅
🎉
last print("sum:"+str(sum))
7Q answer:
a=[]
sum=0
for i in range(1,6):
sum=sum+i
avg=sum/5
Print(sum )
Print(avg)
Output:
15
3.0
@@rajendraprasath8890 just try
@@seethalakshmi9504 bro it is correct ? pls reply i am confused 🤯🤯🤯
It's wrong
U adding the count of the number u need to add the numbers by appending and then find the sum & avg
U dint got input from user u just took your own numbers
Qus 9
A=int(input("enter the number of terms"))
for i in range (1,a+1):
Print("number is:",i,"and cupe of the",i,"is:",i*i*i*)
for i in range(1,6):
Num=(i*i*i)
print("Number is :",i,"and cube of the",i,"is :",Num)
instead of multiplying i by i*i*i u can just manipulate it as Num = (i**3) here ** refers to the power exponential factor which would take any num in its right side to the power of the value in its left side then I**3 wiud be cube of the number i
7Q
a=[ ]
Print ("enter the number ")
For i in range(5):
num=(int(input("enter num"+str(i+1)))
a. append(num)
Print(a)
Sum=0
for i in a:
Sum =sum + i
Ave=sum/5
Print (sum)
Print (ave)
Output:
15
30.0
a=[]
print("enter the number ")
for i in range(5):
num=(int(input("enter num"+str(i+1))))
a.append(num)
print(a)
sum=0
for i in a:
sum =sum + i
ave=sum/5
print(sum)
print(ave)
Hello bro. Thanks so much for your effort. After 12 years gap, I started learning programming. Your tutorial is very helpful for understanding.
Age 12 🤔
a=int(input("enter tha value"))
b=[]
for i in range(a):
b.append(i+1)
print("the first",a, "natural number is : ",b)
🦸
Suber but explain this pls
one small differentiation:
In python while using comma , separator in print statement for concatenate it automatically converts integer to a string so we don't need to specify str(i). Directly you can mention ,i
a = int(input("test data: "))
for i in range(1, a + 1):
print("Number is", i, "and cube of the number", i, "is", i**3)
If we use '+" concatenate for converting integer to string, we need to specify str(i)
a = int(input("test data: "))
for i in range(1, a + 1):
print("Number is " + str(i) + " and cube of the number " + str(i) + " is " + str(i**3))
output:
test data: 5
Number is 1 and cube of the number 1 is 1
Number is 2 and cube of the number 2 is 8
Number is 3 and cube of the number 3 is 27
Number is 4 and cube of the number 4 is 64
Number is 5 and cube of the number 5 is 125
Nice bro
num=int(input())
for loop in range(1,num+2):
a=loop*loop*loop
b="number of "+str(loop)+"cube is "+str(a)
print(b)
7th question answer:
n = int(input())
sum = 0
print("The first",n,"Natural numbers are:")
for i in range(1,n+1):
print(i)
sum = sum + i
print("The sum of",n,"Natural numbers are:",sum)
Ithu 8th question nga
Q9:
a=int(input())
for i in range(1,a+1):
print("the number is",i,"the cube is",i*i*i)
simple answer:
sum=0
a=[]
for i in range(10):
b=int(input())
a.append(b)
sum=sum+a[i]
print(sum)
print(sum/10)
a =[]
sum=0
print("please Enter 5 subject mark :")
for i in range(1,6):
number =int(input("Enter the mark subject" +str(i) +": "))
a.append(number)
sum =sum+number
ave =sum/i
print("Your number list" ,a)
print("The total :",sum)
print("The Average :",ave,"%")
if(ave
7. Answer
а=[]
print ("Natural numbers")
for i in range (1,8):
a.append(i)
print (a)
sum=0
for i in a:
sum=sum+i
print (sum)
Q7:
a=[]
for i in range(1,11):
num=int(input("enter num"+str(i)))
a.append(num)
print(sum(a))
print(sum(a)/10)
Q.no:8
a = [ ]
b = int(input())
for i in range(1,b+1):
a.append(i)
print(a)
sum = 0
for i in a:
sum = sum + i
print(sum)
Bro thx for ur effect
Ur way of learning is simple
Pls continue this series
U teach everything in python
I trust u man
Yes
Last 9 videos pakka but intha video romba confusing sollapona sutthama purila 😢😢😢
9th question....
a=int(input("enter the number_"))
for i in range (1, a+1) :
Print("number is :", i, "and cube of the", i, " Is:", i*i*i)
n=int(input())
for i in range (1,n):
print("Number is : " + str(i) + "and the cube of " + str(i) + "is :" + str(i**3))
Is it correct method
you are correct bro.nice!
7th question
number = int(input("Enter a number :"))
natural_numbers = ' '
sum_numbers = 0
for i in range(1, number + 1):
sum_numbers = sum_numbers + i
natural_numbers = natural_numbers + str(i) + ' '
print(f"The first {number} Natural numbers are : {natural_numbers}")
print(f"The sum of {number} is : {sum_numbers}")
7Q:
a=[]
for i in range (5):
num=int(input ("Enter a number:"))
a.append(num)
sum=sum(a)
len=len(a)
avg=(sum/len)
print(a)
print("sum of a is",sum)
print("average of a is",avg)
Bro instead of using the term (i*i*i) for getting cube of the respective I value....we can use the term (i**3)....this can reduce the length of the code and also it's time saving....try this method guys!
there is no difference in the lines of code in both the cases .so no problem any one of the both logics can be used!
for I in range(1,6):
num=i*i*i
print("Number is:" +str(i),"and cube of the" +str(i),"is:",num)
Output
Number is: 1 and cube of the 1 is:1
Number is: 2 and cube of the 2 is:8
Number is: 3 and cube of the 3 is:27
Number is: 4 and cube of the 4 is:64
Number is: 5 and cube of the 5 is:125
this one is using list :
#same 7th question using list (get 10 numbers from user as input and find sum and avg)
#this time using list
sum = 0
count = 0
a=[]
for i in range(0,5):
ele = int(input(f"enter the number {count+1}: "))
a.append(ele)
count = count + 1
sum = sum + ele
average = sum/count
print(a)
print(sum)
print(average)
Question 9
n=int(input("Input number of terms : "))
for i in range(1,n+1):
print("Number is:",i,"and cube of the ",i,"is :",i*i*i)
31:28
Question no 7.
addition=0
count=0
for i in range(1,11):
num=int(input())
addition=addition+num
count=count+1
avg=addition/count
print(addition)
print(avg)
Question no.9
a=int(input("Enter the number:"))
For i in range(a):
b=i*i*I
Print("number is:"+str(i),"and cube of the"+str(i),"is:",b)
9.
num=int(input("Enter A Number"))
for i in range(1,num+1):
cube=i**3
Print("Number Is:",i,"And Cube Is:",cube)
Q9
Num=0
For I in range(1,6):
Print("number is:, num+i, "and cube of the", num+i, " Is:", i*i*i)
Question 8
n = int(input("Enter the number of terms: "))
numbers = []
for i in range(1, n+1):
numbers.append(i)
print(i, end=" ")
sum=0
for i in numbers:
sum=sum+i
print("
The sum of the first", n, "natural numbers is:",sum)
31:23
question no 9
a=[]
for i in range(1,6):
a.append(i)
print(i*i*i)
7Q:
a=[]
for i in range(10):
num=int(input(str(i+1)+"enter:"))
a.append(num)
sum=0
avg=0
for i in a:
sum=sum+i
avg=sum/10
print(sum)
print(avg)
Q8
a=[]
n=int(input("Enter num:"))
for i in range(1,n+1):
a.append(i)
print(f"The First {n} Natural Number is:{a}")
sum=0
for i in a:
sum=sum+i
print(f"sum={sum}")
Qus-9
n = int(input ())
for i in range(1,n+1):
b = int(input("Enter the num"+str(i)+":"))
c = b**3
print("cube of the",b,"is",c)
here is the 7th question, hope it is correct,
#question 7 : program to read 10 nos from keyboard and find their sum and avg
print ("")
sum =0
count =0
max_limit = int(input ("enter the max range of the sequence: "))
max_limit = max_limit + 1
for i in range (1,max_limit):
elements = int(input("enter the values to be added in the sequence: "))
count = count + 1
sum = (sum + elements)
average = sum/count
print(f"the sum of the sequence is {sum}")
print(f"the average of the sequence is {average}")
Q8:
n=int(input("Enter Number = "))
sum=0
for i in range(1,n+1):
print(i)
sum = sum + i
print("Natural Number")
print("Total Number",sum)
print(sum)
ANSWER:
1
2
3
4
5
6
7
NATURAL NUMBER
TOTAL NUMBER
28
Q9:
n=int(input("Enter Number = "))
sum=0
for i in range(1,n+1):
print("The number is ",i,"the cube of the",i,"is",i**3)
ANSWER:
Enter Number = 5
The number is 1 the cube of the 1 is 1
The number is 2 the cube of the 2 is 8
The number is 3 the cube of the 3 is 27
The number is 4 the cube of the 4 is 64
The number is 5 the cube of the 5 is 125
9th question answer using formatted strings:
for i in range (1,6):
print(f"Number is : {i} and cube of the {i} is :", i*i*i)
8.
a=int(input(enter a number))
for i in range(1,a+1):
print(i)
8)
n =int(input())
b=[]
sum =0
for i in range(n) :
b.append(i+1)
sum =sum +i
print("List",b)
print("Total : ",sum) 31:54 31:54
Super explanation bro all the best ❤ 7 question super thanks bro❤👍
a=int(input("test data"))
b=[]
for i in range(1,a):
b.append(i)
print(b)
for I in range (1, a) or (1, a+1)
8Q Ans:
a=[]
print("n team of natural numbers:")
for I in range(1,8):
b=int(input(str(I)))
a.append(b)
print(a)
sum=0
for I in a:
sum=sum+I
print(sum)
Ans=28
Solution for exercise 8 is
cube = []
a = int(input("Enter the number 1: "))
b = int(input("Enter the number 2: "))
for i in range (a,b+1):
cube.append(i)
print("Cube of Number" + " " + str(i) + " " + str(i*i*i))
print(cube)
entered Value: 5
output is
Enter the number 1: 1
Enter the number 2: 5
Cube of Number 1 1
Cube of Number 2 8
Cube of Number 3 27
Cube of Number 4 64
Cube of Number 5 125
[1, 2, 3, 4, 5]
9.Ans
for i in range(1,6):
print("Number is:",i,"and cube of the",i,"is:",i**3)
8th question perfect answer is:
n=int(input("enter the number:"))
print ("the list of natural numbers before "+str(n)+" are,")
a=[ ]
for i in range(1,n+1):
a.append(i)
print(i,end=" ")
print("
")
b=sum(a)
print("total sum="+str(b))
QUESTION 8:
Q8. Write a program to display n terms of natural numbers and their sum
CODE :
a=[]
sum=0
b=int(input("ENTER THE NUMBER :"))
for i in range(b):
sum=sum+i
a.append(i+1)
print(a)
print("SUM OF THE NUMBERS :",sum)
Q9
a=[]
n=int(input("Enter num:"))
for i in range(1,n+1):
a.append(i)
print(f"Input Number of Terms:{n}")
for i in a:
print(f"Number is:{i} and cube of the {i} is:{i**i}")
g=int(input("enter the number:"))
for i in range(1,g+1):
print("number is:",str(i),"and cube of the ",str(i),"is :",i*i*i)
output:
enter the number:5
number is: 1 and cube of the 1 is : 1
number is: 2 and cube of the 2 is : 8
number is: 3 and cube of the 3 is : 27
number is: 4 and cube of the 4 is : 64
number is: 5 and cube of the 5 is : 125
solution for exercise 7 (using loop and list)
list = []
b = int(input("Enter the Number: "))
for i in range(1,b+1):
list.append(i)
print(list)
sum = 0
for i in list:
sum = sum + i
print(sum)
output:
Enter the Number: 6
[1, 2, 3, 4, 5, 6]
21
8th question:
~~~~~~~~
sum=0
print("The first 7 natural number is:")
for i in range(1,8):
sum=sum+i
print(i)
print("sum of first 7 natural number is:")
print(sum)
Output:
~~~~
The first 7 natural number is:
1
2
3
4
5
6
7
sum of first 7 natural number is:
28
=== Code Execution Successful ===
❤Thank you❤
Super pa
Ithu wrong ithu illa answer
@@KakashiHatake-v1i illaye crt dhaan
@@iyarkai577 nandrii😇
@@Abi_2405 actually output vanthu avaru row ah vara soli irukaru...nenga kudutha output column ah irkum nala parunga...end separator use pananum nu nenaikran
q 8 ans=
sum=0
l=int(input())
for i in range (l):
print(i+1)
sum=sum+i+1
print(sum)
bro 1080p la videos upload pannunga please...
Q.9)
n=int(input("n"))
for i in range(1,n+1):
print("Number is:",i,"and cube of the",i,"is",i*i*i)
Run(F5). Output
n=5
Number is:1 and cup of the 1 is:1
Number is:2 and cup of the 2 is:8
Number is:3 and cup of the 3 is:27
Number is:4 and cup of the 4 is:64
Number is:5 and cup of the 5 is:125
❤❤❤❤❤❤❤❤❤❤
a=1
count=0
b=int(input())
for i in range(b):
sum=a+i
count=count+sum
print(sum)
print(count)
8)n=int(input())
for i in range(n):
print("number is:",i+1,"and cube of the",n,"is:",i*i*i)
Program for cube:
for i in range(1,6):
n=int(input("Enter the number:"))
print("Number is :",i,"and cube of the :",i,"is",i*i*i)
Expected output:
Enter the number:1
Number is : 1 and cube of the : 1 is 1
Enter the number:2
Number is : 2 and cube of the : 2 is 8
Enter the number:3
Number is : 3 and cube of the : 3 is 27
Enter the number:4
Number is : 4 and cube of the : 4 is 64
Enter the number:5
Number is : 5 and cube of the : 5 is 125
Q8:
a=int(input())
for i in range(1,a+1):
print(i)
output:
7
1 2 3 4 5 6 7
where is a sum
8th sum:
sum=0
print("The first 7 natural number is:")
for i in range(1,8):
sum=sum+i
print(i)
print("sum of first 7 natural number is:")
print(sum)
Output:
The first 7 natural number is:
1
2
3
4
5
6
7
sum of first 7 natural number is:
28
=== Code Execution Successful ===
7 .
a=[]
Print("Enter 10 numbers ")
For in in range (10):
num=int(input(f"Enter num {i+1} : "))
a.append(num)
Sum=0
For i in a:
Sum=sum+i
Print(f"sum = {sum}")
Print(f"average ={sum/10}")
8)
a=[]
print("The first 7 natural numbers are:")
for i in range(1,8):
a.append(i)
print(a)
sum=0
for i in a:
sum=sum+i
print("The sum of first 7 natural numbers are:",sum)
8Q
a=int(input("Test Data: "))
b=[]
for n in range(1,a+1):
b.append(n)
print("The first "+str(a)+" natural number is: ")
for n in b:
print(n)
sum=0
for n in b:
sum=sum+n
print("Their sum="+str(sum))
thank u so much for sharing this answer
7q ans
a=[]
c=0
v=0
for i in range(10):
b=int(input())
a.append(b)
v+=1
for j in a:
c=c+j
print(c//v)
n=int(input("Enter the end natural Number:"))
print("The first {} Natural number is:". format(n))
for i in range(1,n+1):
print(i,end=" ")
You have explained if loop at your very best and it was clear, but in for loop you are bringing too much functions that we are confused to understand!!
Idhu varaikum vandha vdos lam purinjuthu indha vdo semmaya kolapiduchu bro😢
ques 9
a=int(input())
for i in range(a):
print("Number is",i+1,"and cube root of",i+1,"is:",((i+1)**3))
8Q
n=int(input("test data:"))
Print ("the first {0} natural number is". format(n))
for i in range(1,n+1)
Print(i, end=' ')
Output:
Test data:7
The first 7 natural number is:
1 2 3 4 5 6 7
#question8 : to find the sum of n natural nos., let me know if it can be minimalized.
sum = 0
count = 0
a = []
n = int(input(f"enter the no. of digits for summing: "))
for i in range (n):
count = count + 1
a.append(count)
print(a)
print(f"the list of natural nos. are:")
for i in (a):
print(i)
sum = sum + i
print (f"the sum value of the sequence: {sum}")
for i in range(1,6):
print("the number :",str(i), "and the cube is", i**3)
Hi EMC and Hello friends ,
Here I am shared the Program for Two questions :
1.Sum of First n natural number :
a=int(input("Test data : "))
b=[]
s=0
for i in range(0,a+1):
b.append(i)
print(i)
s=s+i
print(b)
print(s)
2.Cube Problem:
a=int(input("Test data :"))
sum=0
for i in range(0,a+1):
sum=sum+i
print("Number is : "+str(i)+" and cube of the "+str(i)+" is : ",(i*i*i))
Some what I solved this I am learning too and its because of your teaching please Keep up the Good Work Brother @EMC
Bro ithu correct ahh?
@@UNIQUEFASHION-mr9wl Hi Bro, Please let me know if any changes required . its worked and I got the excepted Output. please let correct me if anything wrong on the code
@@ramkumar-df5fwbro first sum la average varala
gnum=int (input("How many cube value needed:"))
for i in range(gnum):
c=(i+1)
d=c*c*c
print("Number is:",c,"and cube of the",c,"is :",d)
question 9 answer :
for i in range(int(input("no.of terms:"))):
num=((i+1)*(i+1)*(i+1))
print("number is",i+1,"and cube of the",i+1,"is",num)
for i in range(1,6):
Num=(i*i*i)
print("Number is :",i,"and cube of the",i,"is :",Num)
8 question answe program:
a=int(input("Enter number:"))
b=[]
for i in range(a):
b.append(i+1)
for i in b:
print("Number is:",i,"and cube of",i,"is:",i*i*i)
a=[]
sum=0
for i in range(7):
num=int(input("Enter Num "+str(i+1)))
sum=sum+num
print(sum)
Understood clearly bro ❤🔥 Superb🙏🏻
Thank you so much 😀
for i in range(1,6):
print('number is :',i,'and cube of the', i ,'is :',i*i*i)
21:40 instead of changing i into string we can use f(literal string) to add : (colon) after number to make it easier to understand. ie... (f"enter number {i}: ")
7Q ANSWER:
n=[]
for a in range(10):
num=int(input())
n.append(num)
sum=0
for b in (n):
sum=sum+b
print(sum/10)
for I in range(1,6):
num=I*I*I
print("Number is:",I,"cube of the",I,"is:",num)
7. a=[]
sum=0
for i in range(10):
num=int(input("enter num"+str(i+1)+":"))
a.append(num)
print(a)
sum=sum+num
average=sum/len(a)
print(sum)
print(average)
Len(a)- meaning and ethukaka potaram
@@rajamangairajamangai4809to find the length of a
8)num=int(input("enter number"))
for i in range(num):
print(i+1)
7.average output is missing
Avg=sum/len(a)
Print(a)
for i in range(1,7):
print(i, "and cube of the ", i, ":" , str(i*i*i))
a=[]
sum=0
count=0
for i in range(10):
num=int(input("Enter Num "+str(i+1)))
a.append(num)
sum=sum+num
count=count+1
print(sum)
print(sum/count)
Q.8)
n=int(input("n="))
a=[ ]
print("The first 7 natural number is")
for i in range(1,n+1):
Print(i,end=" ")
a.append(i)
sum=0
for i in a:
sum=sum+i
print()
print("sum")
print(sum)
Run(F5). Output
n=7
The first 7 natural numbers is
1234567
sum
28
❤❤❤❤❤❤❤❤❤❤
QN 7: my answer
sum=0
count=0.0
avg=0
lst=[]
for i in range (10):
num=int(input("Enter 10 Numbers to get its sum and avg:"))
lst.append(num)
print(num)
count+=1
print(lst)
sum+=num
avg=sum/count
print("Sum of your numbers is:", sum)
print("Avg of your numbers is:", avg)
a=int(input("a"))
b=int(input("B"))
c=int(input("C"))
d=int(input("D"))
e=int(input("E"))
f=int(input("F"))
g=int(input("G"))
h=int(input("H"))
i=int(input("I"))
j=int(input("J"))
k=a+b+c+d+e+f+g+h+i+j/10
print("the average is", k)
you can use map function for multiple input
#question 9: write a program to display the cube of the number up to an integer. , (let me know if this can be simplified, thanks.)
count = 0
a = []
seq = int(input("enter the value: "))
for i in range (seq):
count = count + 1
a.append(count)
#print (count)
print(f"the {3} root of {count} is: {pow(count,3)}")
Not understand this video
for i in range(1,6):
a=(i*i*i)
print("Number is:",i,"and cube of the",i,'is:',a)
ans:
Number is: 1 and cube of the 1 is: 1
Number is: 2 and cube of the 2 is: 8
Number is: 3 and cube of the 3 is: 27
Number is: 4 and cube of the 4 is: 64
Number is: 5 and cube of the 5 is: 125
_____x_____
8. Write a program to display n terms of natural numbers and their sum
Test Data:7
Expected output: The first 7 natural number is: 1,2,3,4,5,6,7.
My ans 👇🏻:
n=int(input("Enter the number"))
sum=0
for i in range (1,n+1):
sum=sum+i
print("The sum is:" , sum)
• This is correct ✅ or wrong ❌ someone say plz... 😢😖😖.
Question 9:
-----------
Write a program to display cube of the number:
Test Data:
Input number of terms: 5
Expected Output:
----------------
Number is 1: and cube of the 1 is:1
Number is 2: and cube of the 2 is:8
Number is 3: and cube of the 3 is:27
Number is 4: and cube of the 4 is:64
Number is 5: and cube of the 5 is:125
Solution:
---------
a = int(input("Input number of terms: "))
print("Expected Output:")
print("----------------")
for i in range(1,6):
print("Number is:",i,"and cube of the",i,"is:",i*i*i)Output:
Input number of terms: 5
Expected Output:
----------------
Number is: 1 and cube of the 1 is: 1
Number is: 2 and cube of the 2 is: 8
Number is: 3 and cube of the 3 is: 27
Number is: 4 and cube of the 4 is: 64
Number is: 5 and cube of the 5 is: 125
7 question ku answer here
a=[ ]
c=int(input('how many number you have :'))
for i in range(c):
b=int(input( 'enter number '+str(i+1) +'\t:'))
a.append(b)
sum=0
for i in a:
sum=sum+i
average=(sum)/c
print('result is =',average)
Intha video puriyala bro 😢 entha code oda output varamatikithu
n=int(input("Enter the value of n:"))
sum=0
print("the first",n,"natural number is:")
for i in range(1,n+1):
sum=sum+i
print(i)
print("the sum of first",n,"natural numbers is:",sum)
output:
Enter the value of n:5
the first 5 natural number is:
1
2
3
4
5
the sum of first 5 natural numbers is: 15
I haven doubt in understanding forloop with list; 7,8 problem.
In 7th problem how to enter or calculate average.
In that video find out adding and the average.but, adding only shows in video.
Gave a small tip for 8th problem
Qus-8
n = int(input ())
a = [ ]
for i in range(1,n+1):
a.append(i)
print(a)
Hey bro this is your subscriber from Australia!!
My programming exam is commencing on next month week -1 , I kindly request you to post some videos of def class and while loop , import modules and json file as well
I’m an international student from south india
All the best brother. We will try to upload more videos soon.
Sir intha video Romba confuse aaguthu .pls antha 8th qn ku right code Inga sollunga sir
Yes bro konjam reply pannuga bro nenga two questions ha mix panni sollitinga bro ennaku cofuce ha eruku bro 🙏🙏🙏🙏 plZ reply bro na 11k pay panni veliya python basics learn panna join panna but avanga solli thadu puriyala unga video pathu tha kathukatan nenga endha video mattum konjam vera video make panni upload pannuga plZ bro 🙏🙏🙏🙏 nenga unga video va fulla watch pannuga apa tha nenga mistake pannadu ungaluku theriyum so plZ pathu konjam reply pannu bro plzzz bro 🙏🙏🙏🙏🙏🙏
8q and 9q answers correct bro?
a=[]
for i in range(1,8):
a.append(i)
Print("the first 7 natural number is:",a)
sum=0
for i in a:
sum=sum+i
average=sum/2
Print("average:",average)
Output
The first 7 natural number is: [1, 2, 3, 4, 5, 6, 7]
Average: 14.0
9q
for i in range(1,6):
print("number is:",i,"and cube of the",i,"is:",i*i*i)
Correct bro
Wrong, n need to input
#---------Q7 Answer with SUM and Average---------------
-----------------------------My Output-----------------------------------
Input 10 Numbers.
NUM 0: 1
NUM 1: 2
NUM 2: 3
NUM 3: 4
NUM 4: 5
NUM 5: 6
NUM 6: 7
NUM 7: 8
NUM 8: 9
NUM 9: 10
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Sum : 55
Average : 5.5
-----------------------------My Input---------------------------------------
Ten_Numbers = [ ]
print("Input 10 Numbers.")
sum = 0
Count = 0
Avg = 0
for Numbers in range(10):
Input_Number = int(input("NUM " + str(Numbers) + ": "))
Ten_Numbers.append(Input_Number)
sum = sum + Input_Number
Count = Count + 1
Avg = sum / Count
print(Ten_Numbers)
print("Sum :",sum)
print("Average :",Avg)
------------------I hope this will help for someone 😊------------------