depends on state laws, definitions. 'Motor Driven Cycle/motor bicycle' not allowed on interstate is less than 150cc and some places have a 15hp minimum- was Ohio minimum few years back. Motor assisted bicycle or moped in some places like New Jersey or UK has a 2 hp, 50cc upper limit with a speed restriction of 20 mph or 30 or 31 mph- if more than that it becomes a 'motorcycle'
Answer:
while True:
s = input("Enter a word: ")
if s != "":
reversed_s = ''.join(reversed(s))
if s == reversed_s:
print(s + " is a palindrome")
else:
print(s + " is not a palindrome")
else:
break
Explanation:
- Initialize a while loop that iterates until the user enters an empty string
- Ask the user to enter a word
- If the word is not empty, reverse the word
- Check if reversed word is same as the original word. If they are same, then the word is a palindrome. If they are not same, then the word is not a palindrome.
Answer:
The question is completely described and solved below:
Answer:
Since Python is a scripting language, here is code in python.
#prompt user to give check
amount=float(input("Please Enter the check:"))
#prompt user to give service
service=input("Please Enter the service (good, fair or poor):")
# calculate tip on the basis of service
if service =="good":
tip=amount*0.2
elif service=="fair":
tip=amount*0.15
elif service=="poor":
tip=amount*0.05
#calculate total
total=amount+tip
#print tip
print("tip is equal to : {} ".format(tip))
#print total
print("total of the check is : {} ".format(total))
Explanation:
Prompt user to give check and service input.After taking the input from user, based on the service tip will be calculated. if service is "good" then tip will be 20% of the check, tip will be 15% if service is "fair" and tip will be 5% if service is "poor".
Output:
Please Enter the check:125
Please Enter the service (good, fair or poor):good
tip is equal to : 25.0
total of the check is : 150.0
Answer:
def sublist(aList):
new_list = []
for s in aList:
if len(s) < 4:
new_list.append(s)
return new_list
Explanation:
Create a function called sublist that takes one parameter, aList
Inside the function, create a new_list that will hold the strings which are less than 4 characters. Create a for loop that iterates through the aList. If a string in aList is less than 4 characters, add it to the new_list. When the loop is done, return the new_list