Sunday, October 29, 2023

CHAPTER 4 CONDITIONAL STATEMENTS

 

LEARN PYTHON THROUGH SERIES OF ROBOT'S ACTIVITIES 

Janu is a robot girl who works as a maid in a private machine shop. She always helps to improve the performance of the machines. The machine shop is manufacturing various machine products. According to the job requirement, the different dimensions should be given through the machines and the product made up of the raw material should be obtained. Flats, Rods are the raw materials used in the machine shop. Drilling, Shopping, Turning, Passing, and facing are the operations performed in the machine shop. Now Janu's boss said how can you keep these automatic machines running continuously without increasing the downtime and requesting the sequence for it.

He immediately started to sequence all the commands in his memory. [In]list_operation=["planing","facing","shaping","drilling","cutting"]

[In]num_operations=len(list_operation)

[In]num_operations

[Out]5

[In]select_ope=input("select the operation  "  )

[Out] select the operation _________.

# User gives anyone input.

[In]if select_ope in list_operation:

    print("The selected operation is", select_ope)

else:

     print("The selected operation is not available")

[Out] The selected operation is shaping.

#This is repeated here.

[In]select_ope=input("select the operation"  )

[In]if select_ope in list_operation:

    print("The selected operation is", select_ope)

else:

     print("The selected operation is not available")

[In]select_ope=input("select the operation   ")

[In]if select_ope in list_operation:

print("The selected operation is", select_ope)

         get_dim=input("get the dimensions   ")

    print("The dimensions are", get_dim)

else:

     print("The selected operation is not available")

[Out] select the operation   facing

The selected operation is facing

get the dimensions   0.5 mm

The dimensions are 0.5 mm

# lets janu does his facing operation in the machine with 0.5 mm

#set griper pressure for facing operation = 200N and tool number=1

[In]grip_pres=input("Get the gripper pressure  ")

[In]tool_num=input("Get the tool number  ")

[In]if (tool_num==1 and grip_pres==200):

    print("The facing process can start")

print("Kindly check for status and run the machine")

#The operation is repeated again. 

# lets janu does his facing operation in the machine with 0.5 mm

#set griper pressure for facing operation = 200N and tool number=1

[In]grip_pres=int(input("Get the gripper pressure  "))

[In]tool_num=int(input("Get the tool number  "))

[In]if (tool_num==1 or grip_pres==200):

    print("The facing process can start")

else:

    print("Kindly check for status and run the machine")

 

 

No comments:

Post a Comment

CHAPTER 18 EXPLORING THERMODYNAMICS WITH PYTHON: UNDERSTANDING CARNOT'S THEOREM AND MORE

  Python is a versatile programming language that can be used to simulate and analyze various physical phenomena, including thermal physics ...