Computer Science, asked by sunilmrathod2565, 3 months ago

This question is from python ( one program from subject computer)

Attachments:

Answers

Answered by anindyaadhikari13
4

Answer:

Here comes the Python program for the question.

def x():

name=input("Your name? ")

print(f"Hii {name}. Do you have your ID card?")

x=int(input("Enter 1 if you have else enter 0: "))

if x==1:

print("You can jóin.")

elif x==0:

print("You are not allowed.")

else:

print("Invalid Input.")

# calling

n=int(input("How many students? "))

for i in range(n):

x()

The given question is solved using if-else statements. Ask the student whether he/she is having the ID card or not. From the entered value, check whether the user is allowed to jóin or not. If the entered value is 1, the user is allowed. If the entered value is 0, the user is not allowed. For wrong input, an error message should be displayed.

Refer to the attachment.

•••♪

Attachments:
Similar questions