1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
inessss [21]
2 years ago
10

Repeat the exercise in the task 3 (version 2), where in addition you need to ask the user for their citizenship and if they are

currently in prison convicted for a criminal offence. Your program should print a nice message telling the user if they are eligible to vote (i.e. if they are 18+, Canadian and do not live in prison convicted for a criminal offence, then they can vote. Otherwise not). You should modify function is_eligible so it takes to additional paramters as input. In particular the head of the function should be: is_eligible(age, citizenship, prison)
Computers and Technology
1 answer:
Dahasolnce [82]2 years ago
8 0

Using knowledge in phyton it is possible to write code that uses program should print a nice message telling the user if they are eligible to vote.

<h3>Writting in python:</h3>

<em>def is_eligible(age, citizenship, prison):</em>

<em>  # Converting the inputs into lower for validation</em>

<em>  citizenship = citizenship.lower()</em>

<em>  prison = prison.lower()</em>

<em />

<em>  # 18+ Canadian and do not live in prison can vote</em>

<em>  if(age >= 18 and prison == "yes" and (citizenship == "canada" or citizenship == "Canadian")):</em>

<em>    return True</em>

<em>  return False</em>

<em />

<em># Implement your I/O here</em>

<em />

<em># getting required inputs from user</em>

<em>citizenship = input("Please Enter your Citizenship: ")</em>

<em>prison = input("Please Enter if you are in prison YES/NO: ")</em>

<em>age = int(input("Please Enter your Age: "))</em>

<em />

<em>is_eligible = is_eligible(age, citizenship, prison)</em>

<em>if is_eligible:</em>

<em>  print("Congratulations, You are eligible to Vote!!")</em>

<em>else:</em>

<em>  print("Sorry, You can't Vote")</em>

See more about python at brainly.com/question/18502436

#SPJ1

You might be interested in
You are in the middle of a big project at work. all of your work files are on a server at the office. you want to be able to acc
professor190 [17]

Answer: A. RDP

Explanation:

RDP stands for remote desktop protocol which is being developed by Microsoft. Using RDP we can open and edit the files, save the files on the server, and print the files to a printer connected to a computer at home.

Here we have two versions the one used by the client has to run the client version and the one from which the access of the files is required has to run the servers version. RDP listens to port 3389 of both TCP and UDP.

With the help of this protocol one can be able to access all the files from the server computer and hence proves to be very effective in big projects.

5 0
3 years ago
A U.S. social security number consists of a string of 9 digits, such as "444422333". Declare a char array named ssn suitable for
tatuchka [14]

Answer:

Since the question expect us to declare a C-string, the solution code is written in C as follows:

  1.    char ssn[9];
  2.    scanf("%s",ssn);

Explanation:

A C-String is a string written in C language. It is an array of characters. To declare a C-string, we use the keyword, <em>char </em>and then followed with the variable name + brackets and the number of characters in the string. For example, we can create a C-String for the SSN number as in Line 1.

To read standard input into the array, we can use C built-in function, <em>scanf(). </em>Just include a string placeholder, %s, and the variable<em> ssn </em>as arguments to <em>scanf()</em>. This will assign the string input by user to variable <em>ssn</em> as C-String.

8 0
3 years ago
Online library catalogs can direct you to your closest library. (1 point)<br> True<br> False
Kitty [74]

Answer:

True

Explanation:

8 0
3 years ago
All organizations need good quality cybersecurity to ensure _____. Select 4 options.
vova2212 [387]

Answer:

option 1

Explanation:

it is because they need better security for operational

7 0
3 years ago
Read 2 more answers
Implement a sublinear running time complexity recursive function in Java public static long exponentiation (long x, int n) to ca
Charra [1.4K]

Answer:

Following are the code block in the Java Programming Language.

//define recursive function

public static long exponentiation(long x, int n) {

//check the integer variable is equal to the 0.

if (x == 0) {

//then, return 1

return 1;

}

//Otherwise, set else

else {

//set long data type variable

long q = exponentiation(x, n/2);

q *= q;

//check if the remainder is 1

if (n % 2 == 1) {

q *= x;

}

//return the variable

return q;

}

}

Explanation:

<u>Following are the description of the code block</u>.

  • Firstly, we define the long data type recursive function.
  • Then, set the if conditional statement and return the value 1.
  • Otherwise, set the long data type variable 'q' that sore the output of the recursive function.
  • Set the if conditional statement and check that the remainder is 1 and return the variable 'q'.
4 0
3 years ago
Other questions:
  • Maria is comparing her history project's second-place award to her classmate's first-place award. She starts planning how to win
    6·2 answers
  • True false you cannot fill in a callout​
    14·1 answer
  • blank affect your vision because your eye muscles are tired along with the rest of your body and is difficult to focus
    11·2 answers
  • What adds the element carbon to the environment
    10·2 answers
  • The feature present in most GUIs that helps organize multiple documents or files is _____.
    5·1 answer
  • What is a slide master ?
    8·2 answers
  • The CMS Quarterly Provider Update (QPU) is an online CMS publication that contains information about __________ currently under
    14·1 answer
  • _________ can be used to provide access control, confidentiality, data origin authentication, connectionless integrity, rejectio
    12·1 answer
  • 2. What is MOST TRUE of a mature technology?
    7·1 answer
  • 40 points for this question
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!