[Python Programming Basics to Advanced]: Calculations with for loop (p1) | Lab 09P-2

preview_player
Показать описание
This Python programming playlist is designed to take beginners with zero programming experience to an expert level. The course covers installation, basic syntax, practical scenarios, and efficient logic building. The course material includes PDF handouts, review questions, and covers a wide range of topics, from data types to advanced functions like Lambda and Recursive functions, Generators, and JSON data parsing.

In this lesson we will continue our discussion on for loop and will explore different calculation we can perform using the for loop. In this video we will see the counting calculation which we can do with for loop.

In next video we will explore other calculations.

Complete Playlist:

If you have the basic programming knowledge and interested to learn Object-Oriented Programming in Python, check out this playlist:

Lab Manual 09 can be downloaded from here:

Review Questions:
1- As given at 05:08 in video.

#PythonProgramming #python #pythontutorial
Рекомендации по теме
Комментарии
Автор

Review Q No:01
Count=0
for x in range(8):
Bits=eval(input(f'Enter a Bit {x}: '))
if Bits==1:
Count+=1
if Count%2==0:
Even=0
Odd=1
else:
Even=1
Odd=0
print(f'The even parity is:{Even}')
print(f'The odd parity is:{Odd}')

muhammad-ahmad
Автор

count=0
for i in range(0, 8):
num= int(input("enter a bit :"))
if num==1:
count+=1
else:continue
if count%2==1:
print("even parity bit is 1 ")
print("odd parity bit is 0 ")
else:
print("even parity bit is 0 ")
print("odd parity bit is 1 ")

usmantariq
Автор

count = 0
for i in range(8):
bits = eval(input(f"Enter bit {i}: "))
if(bits == 1):
count += 1
if(count%2==0):
even_parity = 0
odd_parity = 1
else:
even_parity = 1
odd_parity = 0
print(f'The even parity is {even_parity}')
print(f'The odd parity is {odd_parity}')

hamidiftikhar
Автор

Q1:
count=0
for i in range(8):
bit=eval(input(f'Enter a bit {i}: '))
if bit==1:
count+=1
if count%2==0:
Even=0
Odd=1
else:
Even=1
Odd=0
print(f'The EVEN PARITY is:{Even}')
print(f'The ODD PARITY is:{Odd}')

asmaabhatti
Автор

Question No.1
count=0
for x in range(8):
Bits=eval(input(f"Enter a bit {x}: "))
if Bits==1:
count+=1
if count%2==0:
Even=0
Odd=1
else:
Even=1
Odd=0
print(f"The even parity is:{Even}")
print(f"The odd parity is:{Odd}")

mujtabashabbir
Автор

#Part-2
count=0
for i in range (8):
p=eval(input(f'Enter bit-{i+1}: '))
if(p==1):
count+=1
if(count%2==1):
print(f"The EVEN PARITY is: {1}")
print(f"The ODD PARITY is:{0}")
else:
print(f"The EVEN PARITY is: {0}")
print(f"The ODD PARITY is:{1}")

shaheerahmadkhan
Автор

Review Question
count=0
for c in range(8):
B=int(input(f'Enter a bit {c}:'))
if B==1:
count+=1
if count%2==0:
e=1
o=0
else:
e=0
o=1
print(f'The EVEN PARITY is:{o}')
print(f'The ODD PARITY is:{e}')

nukhbaiqbal
Автор

count=0
for i in range(1, 9):
# User should enter 0 or 1
x=eval(input('Enter The number:'))
if x==1:
count+=1
if count%2==0:
print('Even Parity is : 0')
print('Odd Parity is : 1')
else:
print('Even Parity is : 1')
print('Odd Parity is : 0')

AsadAli-owie
Автор

count=0
for i in range(8):
num=eval(input(f"enter {i} bit: "))
if (num==1):
count+=1

if (count%2==0):
print("even parity is 0")
print("odd parity is 1")
else:
print("even parity is 1")
print("odd parity is 0")

AliIrfan-soxf
Автор

1)
Count=0
for x in range(8):
Bits=eval(input(f'Enter a Bit {x}: '))
if Bits==1:
Count+=1
if Count%2==0:
Even=0
Odd=1
else:
Even=1
Odd=0
print(f'the even parity is:{Even}')
print(f'The odd parity is:{Odd}')

haseebahmad
Автор

count=0
for i in range(8):
B=int(input(f"Enter a bit {i}:"))
if B==1:
count+=1
if count%2==0:
x=0
y=1
else:
x=1
y=0
print(f"The Even parity is:{x}")
print(f"The odd parity is:{y}")

yusrakashif
Автор

a=0

for i in range(0, 8):
Bits=int(input(f"Enter a bit {i+1}: "))
if Bits==1:
a=a+1
if a%2==0:
Even=0
Odd=1
else:
Even=1
Odd=0
print(f"The even parity is:{Even}")
print(f"The odd parity is:{Odd}")

fourcloversan
Автор

ANS:

count=0
for b in range(8)
B=eval(input (f'Enter a bit{b}:')
if B==1
count +=1
if count%2==0
even =0
odd =1
else :
even =1
odd=0
print(f' The even PARITY is {even} :')
print (f' The odd PARITY is {odd} :')

abdullahmughal
Автор

count=0
for d in range(8):
D=int(input(f"Enter a bit {d}:"))
if D==1:
count+=1
if count%2==0:
q=1
w=0
else:
q=0
w=1
print(f"Here is the Even :{q}")
print(f"Here is the Odd :{w}")

dawood
Автор

count=0
for i in range(8):
x=int(input(f'Enter bit-{i+1}: '))
if(x==1):
count+=1
if(count%2==0):
print('The EVEN PARITY is: 0')
print('The ODD PARITY is: 1')
else:
print('The EVEN PARITY is: 1')
print('The ODD PARITY is: 0')

usman_tariq
Автор

count=0
for i in range(8):
bit=eval(input(f'Enter a bit {i}: '))
if bit==1:
count+=1
if count%2==0:
Even=0
Odd=1
else:
Even=1
Odd=0
print(f'The even party is:{Even}')
print(f'The odd party is:{Odd}')

talhakamboh
Автор

#Review question:
count=0
for i in range(8):
x=eval(input('Enetr a bit:'))
if(x==1):
count+=1
if(count%2==0):
even=0
odd=1
else:
even=1
odd=0
print(f'Even parity is \'{even}\'')
print(f'Odd parity is \'{odd}\'')

abdulrehmankhalid
Автор

count=0
for i in range(-1, 8):
bit=int(input(f"Enter bit {i+1}: "))
if(bit==1):
count+=1
if(count%2==0):
even=0
odd=1
else:
even=1
odd=1
print(f'The EVEN PARITY is {even}')
print(f'The ODD PARITY is {odd}')

laveezayasin
Автор

REVIEW 1:
count=0
for x in range(8):
bits=eval(input(f'Enter a bit {x}: '))
if bits==1:
count+=1
if count%2==0:
Even=0
Odd=1
else:
Even=1
Odd=0
print(f'The even parity is:{Even}')
print(f'The odd parity is:{Odd}')

MuhammadQasim-kwer
Автор

#Review Question
count=0

for i in range(8):
bit=eval(input(f'Enter a bit {i}: '))
if bit==1:
count+=1
if count%2==0:
Even=0
Odd=1
else:
Even=1
Odd=0
print(f'The EVEN PARITY is:{Even}')
print(f'The ODD PARITY is:{Odd}')

akaabdullahmateen
join shbcf.ru