Single File Programming QuestionProblem StatementIn a theme park, only people who meet specific criteria can experience the thrill of the roller coaster. Develop a program that takes age and height as inputs, determining eligibility using logical operators. If the age is 18 or older and the height is 150 cm or taller, output "Allowed!" Otherwise, output "Sorry, Not allowed."Input format :The first line of input consists of an integer, which represents the person's age.The second line of input consists of an integer, which represents the person's height (in cm).Output format :The output displays either "Allowed!" or "Sorry, Not allowed" based on the given conditions.Refer to the sample output for the formatting specifications.Code constraints :In the given scenario, the test cases will fall under the following constraints:6 ≤ age ≤ 10050 ≤ height ≤ 200Sample test cases :Input 1 :28151Output 1 :Allowed!Input 2 :17151Output 2 :Sorry, Not allowedInput 3 :6200Output 3 :Sorry, Not allowedInput 4 :18150Output 4 :Allowed!
Question
Single File Programming QuestionProblem StatementIn a theme park, only people who meet specific criteria can experience the thrill of the roller coaster. Develop a program that takes age and height as inputs, determining eligibility using logical operators. If the age is 18 or older and the height is 150 cm or taller, output "Allowed!" Otherwise, output "Sorry, Not allowed."Input format :The first line of input consists of an integer, which represents the person's age.The second line of input consists of an integer, which represents the person's height (in cm).Output format :The output displays either "Allowed!" or "Sorry, Not allowed" based on the given conditions.Refer to the sample output for the formatting specifications.Code constraints :In the given scenario, the test cases will fall under the following constraints:6 ≤ age ≤ 10050 ≤ height ≤ 200Sample test cases :Input 1 :28151Output 1 :Allowed!Input 2 :17151Output 2 :Sorry, Not allowedInput 3 :6200Output 3 :Sorry, Not allowedInput 4 :18150Output 4 :Allowed!
Solution
Here is a Python solution for the problem:
# Get the age and height from the user
age = int(input())
height = int(input())
# Check if the person is eligible to ride the roller coaster
if age >= 18 and height >= 150:
print("Allowed!")
else:
print("Sorry, Not allowed.")
This program works by first taking the age and height as inputs from the user. It then checks if the age is greater than or equal to 18 and the height is greater than or equal to 150. If both conditions are met, it prints "Allowed!". If not, it prints "Sorry, Not allowed."
Similar Questions
Single File Programming QuestionProblem StatementJohn is eager to create a simple program for gathering and presenting personal details. Write a program that prompts users to provide the initial letter of their name (a character), age (an integer), and height in meters (a floating-point number).After collecting this information, display it in a well-organized format.Input format :The input consists of three space-separated values, representing the first letter of the name (character), age (integer), and height in meters (floating point value), separated by spaces.Output format :The first line prints the initial of the name in the format "Initial: [initial]"The second line prints the age in the format "Age: [age] years"The third line prints the height of the person, rounded to two decimal places, in the format "Height: [height] meters"Refer to the sample output for formatting specifications.Code constraints :In the given scenario, the test cases will fall under the following constraints:10 ≤ Age ≤ 500.01 ≤ Height ≤ 1.80Sample test cases :Input 1 :A 10 1.35Output 1 :Initial: AAge: 10 yearsHeight: 1.35 metersInput 2 :b 25 1.70Output 2 :Initial: bAge: 25 yearsHeight: 1.70 metersInput 3 :Z 28 1.80Output 3 :Initial: ZAge: 28 yearsHeight: 1.80 metersCode Size : 1024 kbNote :The program will be evaluated only after the “Submit Code” is clicked.Extra spaces and new line characters in the program output will result in the failure of the test case.Marks : 10Negative Marks : 0
Single File Programming QuestionProblem Statement In a digital game, players input a number to unlock levels. Develop a program using logical operators that takes an integer as input and checks whether it satisfies the specified conditions to unlock the next level.The number must be greater than or equal to 10.The number must be less than or equal to 100.The number must not be divisible by 7.Implement a program to notify players of their eligibility to unlock the next game level.Input format :The input consists of an integer n, representing the player's entered number.Output format :The output displays "Unlock Next Level" if the input meets the conditions; otherwise, it prints "Level Locked".Refer to the sample output for the formatting specifications.Code constraints :In the given scenario, the test cases will fall under the following constraints:1 ≤ n ≤ 200Sample test cases :Input 1 :1Output 1 :Level LockedInput 2 :49Output 2 :Level LockedInput 3 :12Output 3 :Unlock Next LevelInput 4 :100Output 4 :Unlock Next LevelInput 5 :152Output 5 :Level Locked
Single File Programming QuestionProblem StatementAryan, a recruiter, requires a program to screen candidates for a fitness program. The program must accommodate input from a specified number of candidates, denoted by N. For each candidate, four distinct values should be entered: age (an integer), height (a float), weight (an integer), and chest size (an integer). The program's objective is to evaluate these candidates against certain eligibility criteria. Once the evaluation is complete, it should display the indices (using 0-based indexing) of those candidates who meet the specified eligibility criteria. Age should be greater than 18 and less than 25Height between 5.7 and 6.0 feet (both inclusive).Weight between 45 and 60 kg (both inclusive).Chest size greater than 45 inches.Input format :The first line consists of an integer N, representing the number of candidates.The next N lines consist of four space-separated values, representing age (an integer), height (float), weight (an integer), and chest size (an integer).Output format :If there are eligible candidates, print space-separated indices of those candidates.If no eligible candidates are found, print -1.Refer to the sample output for the formatting specifications.Code constraints :In the given scenario, the test cases fall under the following constraints:1 ≤ N ≤ 1018 ≤ age ≤ 255.7 ≤ height ≤ 6.045 ≤ weight ≤ 60chest size > 45Sample test cases :Input 1 :522 5.8 48 5415 5.8 40 5224 5.8 48 56 12 5.2 45 6020 5.9 55 48Output 1 :0 2 4 Input 2 :218 3.8 38 3819 5.5 45 45Output 2 :-1Input 3 :1022 5.8 48 5415 5.8 40 5224 5.8 48 5612 5.2 45 6020 5.9 55 4819 5.7 46 4823 6.0 52 5018 5.6 42 4825 5.8 50 4621 6.1 60 55Output 3 :0 2 4 6
Single File Programming QuestionProblem StatementA school administrator needs to display the information of a student. The student has an ID (an integer) of 15, an age (an integer) of 23 and achieved a grade (a character) 'B'. Write a C program to print these details using appropriate data types and formatting.Input format :No console input.Output format :The output displays the values in the below format:Student id: 15Student age: 23Student grade: BRefer to the sample output for the formatting specification
Problem StatementBuild a program for a small town where individuals are eligible to vote only if they are 18 years or older. Take the age of a person as input and indicate their eligibility. If the age is 18 or above, print "Eligible for Voting"; otherwise, print "Not eligible for Voting" using the ternary operator.Input format :The input is an integer n, representing the age of the person.Output format :The output displays either "Eligible for Voting" or "Not eligible for Voting" based on age.Refer to the sample output for formatting specifications.Code constraints :In the given scenario, the test cases will fall under the following constraints:1 ≤ n ≤ 100Sample test cases :Input 1 :18Output 1 :Eligible for VotingInput 2 :37Output 2 :Eligible for VotingInput 3 :12Output 3 :Not eligible for VotingInput 4 :9Output 4 :Not eligible for Voting
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.