# do comment if any problem arises
# Code
#global contraints
ALLOWEDINT = [1, 2, 3, 4]
ALLOWEDLENGTH = 4
# a)
# this function returns true if input is not in list
def check_Int(integers):
for integer in integers:
if int(integer) not in ALLOWEDINT:
return True
return False
# b)
# this function returns true if
def check_Length(integers):
if len(integers) != 4:
return True
return False
# c)
def get_input():
integers=input('Enter a string: ')
while check_Int(integers) or check_Length(integers):
integers=input('Invalid input! Re-Enter a string: ')
return integers
user_input=get_input()
print(f'You entered {user_input}')
Screenshot of code:
![#global contraints 3 [1, 2, 3, 4] 4 ALLOWEDINT 5 ALLOWEDLENGTH 4 6 7 # a) # this function returns true if input is not in lis](http://img.homeworklib.com/questions/d2acb580-b018-11ea-a071-45401dbf0a47.png?x-oss-process=image/resize,w_560)
Output:

note: I’m trying to do this in 3 separate defined functions. My main area of confusion...
Need help writing these functions in Python: FUNCTION 1 get_course_ids: Consumes a list of Course dictionaries and returns a list of integers representing course IDs. Here's what I have so far but I'm getting a Type Error - list indices must be integers or slices, not dict. def get_course_ids(courses): course_ids = [] for course in courses: course_ids.extend(courses[course]) return course_ids FUNCTION 2 choose_course: Consumes a list of integers representing course IDs and prompts the user to enter a valid ID,...
Can someone fix this python program? I'm trying to do three things: Create a function that takes in a string as a parameter. Then create a dictionary of characters to integers, where the integer represents how many times the number of times the character appears in the word. Create a function that takes two lists as parameters and returns the elements they have in common of the two lists. Ask the user to create a list of numbers and keep...
Using Python 3+ for Question P5.9
Instructions: Use one main() to call each of
the functions you created. Only use one value of r and h for all
the function. Ask the user for the r and h in the main() as an
input, and h for all the functions. You should put the
functions for areas in a separate file.
For example, firstDigtec7ze Write a function e digits n) (returning the number of digits in the argument returning...
Write the following functions, as defined by the given IPO comments. Remember to include the IPO comments in your submission. Be sure to test your code -- you can use the examples given for each function, but you should probably test additional examples as well -- and then comment-out or remove your testing code from your submission!. We will be testing your functions using a separate program, and if your own testing code runs when we load your file it...
USING PYTHON 3. For this question, you will build three helper functions and one main function. All four functions must work together to draw the letter ‘H. Every line of code written should be inside of a function. Here are the function specifications: 1) Helper function (given): def draw_edges(symbol, width): print(symbol + " "*(width-2) + symbol) 2) Helper function: draw_H(symbol, width, height): This function will draw an "H" symbol, given the symbol, width, and height. This function must call the...
Please write code using Python.
Rubric
Assignment Solution Total: 100 pts
Program successfully retrieves and validates user input 15
pts
Morse Code Function Created 10 pts
Function Uses Parameters to get input message 15 pts
Function successfully converts passed message to Morse Code
and returns the Morse Code equivalent of message 45 pts
Program calls Morse Code function and outputs the result of
the function (i.e. the actual Morse Code) 15 pts
Main Function Requirement
Part 2 MUST have a...
A)) (Ransom Note Problem) in python A kidnapper kidnaps you and writes a ransom note. He does not write it by hand to avoid having his hand writing being recognized, so he uses a magazine to create a ransom note. We need to find out, given the ransom string and magazine string, is it possible to create a given ransom note. The kidnapper can use individual characters of words. Here is how your program should work to simulate the ransom...
Implement a tic-tac-toe game. Currently, if the variables provided in main are commented out, the program will compile. Complete the specifications for each function. As you develop the program, implement one function at a time, and test that function. The provided comments provide hints as to what each function should do and when each should be called. Add variables where you see fit. Implementation Strategies: The template has variables and two global constants for you to utilize. The template has...
Hi. Please help me solve this in python using only while loops,
if statements. Can't use for loops and lists.
In this programming assignment, you will be writing a program that prints out several shapes via text. In this PA, you will be required to use functions and parameters. This is both to reduce redundancy and to make your code clean and well-structured. Name your program shaper.py Your program should have the capability to print out three different shapes: An...
It is a C++ program by using
inheritance and vectors
My professor said that all the files should be separate. like
File.cpp, File.h, Text.cpp,Text.h,Main.cpp
I already have these files
File.cpp
#include "File.h"
// Constructor of File that takes File name and type as
arguments
File::File(string type, string name) {
this->type = type;
this->name = name;
}
//returns the type.
string File::getType() {
return type;
}
//returns the name of file.
string File::getName() {
return name;
}
File.h
#ifndef __FILE_H__
#define...