Tutorial on for loop and difference between while loop and for loop

preview_player
Показать описание
Tutorial on for loop and difference between while loop and for loop
"Week: 3
Topic: Tutorial on for loop and difference between while loop and for loop" IIT Madras welcomes you to the world’s first BSc Degree program in Programming and Data Science. This program was designed for students and working professionals from various educational backgrounds and different age groups to give them an opportunity to study from IIT Madras without having to write the JEE. Through our online programs, we help our learners to get access to a world-class curriculum in Data Science and Programming.

To know more about our Programs, please visit :
Рекомендации по теме
Комментарии
Автор

1:00 (factorial)
3:13 3:49 5:00 5:39 6:05 (factor while vs for)
6:30 (digits example)
9:25 (reverse the digits example)
13:44 (palindrome)
16:00 (problem statement - ideal loop)

avenumadhav
Автор

please make sure, the contents in the slides are neither at the very top nor at the very bottom. it becomes difficult to pause and read.

vaibhavkumar
Автор

5:19 shouldn't in the third line, while condition be '(num>9)'? Because if input is '10' then its number of digits if '2' but this code will show '1'.

meriid
Автор

n = int(input())
fac = 1
if (n < 0):
print("not defined")
else:
for i in range(1, n+1):
fac = fac * i
print(fac)

bhanugupta
Автор

08:40: Left code will give you 1 for 10.
So On the left code, condition of while loop should be num>9

बिहारीभायजी
Автор

# find the sum of all digits in the given number

n = int(input())
sum = 0
while(n>0):
l = n % 10
sum += l
n = n // 10
print(sum)

bhanugupta
Автор

19:12 9th problem statement, there is all positive numbers so I don't understand how range is determined?

Saksham_
join shbcf.ru