Lecture 16 - nested if else, if elif else | #Python for Oil and Gas

preview_player
Показать описание
-------------------------------------------------------- Python for Oil and Gas -------------------------------------------------------------------

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

Hey, can you help me with a problem?it doesn't work out for me.

caligula
Автор

maximum porosity"))
if max_porosity==0.476:
print("It is cubic packing")
elif max_porosity==0.395:
print("It is hexagonal packing")
elif max_porosity==0.260:
print("It is rhombohedral packing")
elif max_porosity==0.302:
print("It is tetragonal packing")
else:
print("This kind of packing does not match any of the options given")

animeshagarwal
Автор

porosity = float(input('What is the porosity of your formation?'))

if 0.395 < porosity <= 0.476:
print('It is Cubic packing!')
elif 0.302 < porosity <= 0.395:
print('It is Hexagonal packing!')
elif 0.260 < porosity <= 0.302:
print('It is Tetragonal packing!')
elif porosity <= 0.260:
print('It is Rhomohedral packing!')
else:
print('This kind of packing does not match any of the options given')

shytsnake
Автор

maximum_porosity = float(input('what is the maximum porosity value ? '))

if maximum_porosity == 0.476:
print('it is cubic.')
elif maximum_porosity == 0.395:
print('it is hexagonal.')
elif maximum_porosity == 0.260:
print('it is rhomohedral.')
elif maximum_porosity == 0.302:
print('it is tetragonal.')
else:
print('This kind of packing does not match any of the options given.')

bilgimc
Автор

porosity= float(input("Please enter the value of maximum porosity"))
if porosity == 0.476: print(f'It is cubic packing with value {porosity}')
elif porosity == 0.395: print(f'It is Hexagonal packing with value {porosity}')
elif porosity == 0.260: print(f'It is Rhombohedral packing with value {porosity}')
elif porosity == 0.302: print(f'It is Tetragonal packing with value {porosity}')
else: print('This kind of packing does not match any of the options given')

hiitis
welcome to shbcf.ru