Programming

Programming questions? Ask a programmer for answers ASAP

Ask a Computer Expert,
Get an Answer ASAP!

This answer was rated:

Def main(): #Ask the user for number of pocket

Def main():#Ask the user...

Def main():#Ask the user for number of pocket
number_of_pocket = int(input("Enter a pocket number: "))#Determine the color
if number_of_pocket == 0:
print ("green")
else:
number_of_pocket >= 1 and number_of_pocket <= 10
if number_of_pocket % 2 :
print("Pocket", number_of_pocket, "is red")
else:
print("Pocket", number_of_pocket, "is black")
else:
number_of_pocket >= 11 and number_of_pocket <= 18
if number_of_pocket % 2:
print("Pocket", number_of_pocket, "is black")
else:
print("Pocket", number_of_pocket, "is red")
else:
number_of_pocket >= 19 and number_of_pocket <= 28
if number_of_pocket % 2:
print("Pocket", number_of_pocket, "is red")
else:
print("Pocket", number_of_pocket, "is black")
else:
number_of_pocket >= 29 and number_of_pocket <= 36
if number_of_pocket % 2:
print("Pocket", number_of_pocket, "is black")
else:
print("Pocket", number_of_pocket, "is red")
else:
print("That is not a vaild pocket number")

Technician's Assistant: What programs and versions are you using?

I'm using cs50.io I keep getting syntax error and I cant fix it

Technician's Assistant: What is your ideal outcome? How can we solve this for you?

I need someone to check what the error is for me

Technician's Assistant: Anything else you want the programmer to know before I connect you?

No that would be it for now

Show More
Show Less
Ask Your Own Programming Question
Answered in 3 minutes by:
9/18/2017
George Sibiya
George Sibiya, Computer Hardware Engineer
Category: Programming
Satisfied Customers: 364
Experience: PhD in Computer Science
Verified

Hi,

Welcome to JustAnswer and thank you for utilising our services.

I'll help debug it and post back shortly

Regards,

G

Ask Your Own Programming Question

This one should work just fine

George Sibiya
George Sibiya, Computer Hardware Engineer
Category: Programming
Satisfied Customers: 364
Experience: PhD in Computer Science
Verified
George Sibiya and 87 other Programming Specialists are ready to help you
Ask your own question now
Was this answer helpful?

How JustAnswer works

step-image
Describe your issueThe assistant will guide you
step-image
Chat 1:1 with a programmerLicensed Experts are available 24/7
step-image
100% satisfaction guaranteeGet all the answers you need
Ask George Sibiya Your Own Question
George Sibiya
George Sibiya
George Sibiya, Computer Hardware Engineer
Category: Programming
Satisfied Customers: 364
364 Satisfied Customers
Experience: PhD in Computer Science

George Sibiya is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed.

One Happy CustomerNew York

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

< Previous | Next >

Meet the Experts:

ATLPROG

ATLPROG

Computer Software Engineer

7,677 satisfied customers

MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

LogicPro

LogicPro

Computer Software Engineer

7,175 satisfied customers

Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.

unvadim

unvadim

Computer Software Engineer

1,168 satisfied customers

Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

lifesaver

lifesaver

Computer Software Engineer

950 satisfied customers

Several years of intensive programming and application development experience in various platforms.

ehabtutor

ehabtutor

Computer Software Engineer

936 satisfied customers

Bachelor of computer science, 5+ years experience in software development, software company owner

TheDoctor

TheDoctor

Software Engineer

893 satisfied customers

M.S. in Internet Information Systems

The-PC-Guy

The-PC-Guy

Software Engineer

848 satisfied customers

Extensive Knowledge in PHP, MYSQL, CSS & Javascript

< Previous | Next >

Related Programming Questions
This program is a number guessing game. It generates 5
This program is a number guessing game. It generates 5 random numbers between 1 and 68. It prompts the user / player to enter a number. It validates the number to make sure the number entered by the u… read more
George Sibiya
George Sibiya
Computer Hardware Engineer
PhD
364 satisfied customers
Line of code?...here is the error I get, try: #Get the name
try: #Get the name of a file filename = raw_input('Enter a file name: ')#Open the file infile = open(filename, 'r')with open(infile) as f: data = [int(line) for line in f]print('The minimum value is ', min(data)) print('The maximum value is ', max(data)) print("The average value is ", sum(data)/len(data)) try: #Get the name of a file filename = raw_input('Enter a file name: ')#Open the file infile = open(filename, 'r')with open(infile) as f: data = [int(line) for line in f]print('The minimum value is ', min(data)) print('The maximum value is ', max(data)) print("The average value is ", sum(data)/len(data)) … read more
Bhavik Joshi
Bhavik Joshi
Computer Science and Engineering
919 satisfied customers
The following is an assignment for an online C++ class that
The following is an assignment for an online C++ class that I desperately need some help on. Especially in knowing how to begin. I'm new to modularity and don't fully understand the concept, though I … read more
jatechexpert
jatechexpert
Master\u0027s Degree
1 satisfied customers
1. Need to add a new function, named isDateValid, which will
1. Need to add a new function, named isDateValid, which will be data type bool that tests the input date to see if it is in-range/valid date. The function will have input parameters to pass the date t… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
1. Which of the following statement assigns the values stored
1. Which of the following statement assigns the values stored in x to the second element on an array, ary? a. ary = x; b. ary = x[0]; c. ary = x[1]; d. ary[0] = x; e. ary[1] = x; 2. The following is a… read more
Simit
Simit
Bachelor\u0027s Degree
2,001 satisfied customers
Objective Use your knowledge of C++ to identify and correct
Objective: Use your knowledge of C++ to identify and correct the syntax and formatting errors in the following C++ code: /****************************************************************** * Programme… read more
Ramesh Patil
Ramesh Patil
Master's Degree
417 satisfied customers
Another input validation exercise. Design a program that
Another input validation exercise. Design a program that prompts the user to enter an employee's hourly pay rate and the number of hours worked. Validate the user's input so that only pay rates in the… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
Hello I have no idea how to write the following program Write
Hello I have no idea how to write the following program Write a program that generates two integers under 100 and prompts the user to enter the sum of these two integers. The program then reports true… read more
unvadim
unvadim
Computer Software Engineer
Diplom
1,168 satisfied customers
email me if you can complete this in two days. [email protected] 1.What
email me if you can complete this in two [email protected] 1.What is the value of the expression that follows? strcmp("5", "49"); A) -1 B) 0 C) 1 D) < E) > 2. What is/are the simple case(s) of… read more
Nilesh
Nilesh
Bachelor\u0027s Degree
649 satisfied customers
Write a java program that reads in a list of numbers from the
Write a java program that reads in a list of numbers from the user and generates a histogram of those numbers. Your program must include the following functionality: •Uses a JOptionPane to get the num… read more
Todd
Todd
Bachelor\u0027s Degree
396 satisfied customers
Write a Java program that meets the following requirements
Write a Java program that meets the following requirements: Declare a method to determine whether an integer is a prime number Use the following method declarations: public static Boolean isPrime (int… read more
Ansh P.
Ansh P.
System Analyst
Bachelor\u0027s Degree
6,393 satisfied customers
here is a new one for you...this is where it is at..http //www.mediafire.com/ jxyjtyk
here is a new one for you...this is where it is at..http://www.mediafire.com/?jxyjtykym5z and http://www.mediafire.com/?1zq3yrjmdm5 I am not sure of your schedule but if we could shoot for this weeken… read more
Eric M.
Eric M.
PhD Candidate
Master\u0027s Degree
66 satisfied customers
how would you write a program that computes and prints the
how would you? write a program that: computes and prints the Wallis and Taylor approximations of pi and then compare those results to the value of pi from math.pi?… read more
Eric M.
Eric M.
PhD Candidate
Master\u0027s Degree
66 satisfied customers
Write a Java program that meets the following requirements Declare
Write a Java program that meets the following requirements: Declare a method to determine whether an integer is a prime number Use the following method declarations: public static Boolean isPrime (int… read more
lifesaver
lifesaver
Computer Software Engineer
Bachelor's Degree
950 satisfied customers
C++ ; Write a program that presents a menu of options
Program: Write a program that presents a menu of options to the user to choose from, one of the options should be quit the program. If the user enters an option that is not in the list, the program sh… read more
Robert Preston
Robert Preston
Technician, Developer
Associate Degree
3,525 satisfied customers
Input two integer numbers, then use four functions that will
Input two integer numbers, then use four functions that will perform the following:Add the two numbers, subtract the two numbers, calculate the product of the two numbers, and calculate the quotient a… read more
lifesaver
lifesaver
Computer Software Engineer
Bachelor's Degree
950 satisfied customers
1 of 25 The terminating condition is ______. Refer to
1 of 25 The terminating condition is ______. Refer to function fox below. int fox(int m, int n) { int ans; if (m < 10) if (n < 10) ans = m + n; else ans = fox(m, n - 2) + n; else ans = fox(m - 1… read more
lifesaver
lifesaver
Computer Software Engineer
Bachelor's Degree
950 satisfied customers
1. What is the value of the expression that follows strcmp( 5 ,
1. What is the value of the expression that follows? strcmp("5", "49"); A) -1 B) 0 C) 1 D) < E) > 2. What is/are the simple case(s) of recursive function ten? int ten(int n) { int ans; if (n <… read more
Ansh P.
Ansh P.
System Analyst
Bachelor\u0027s Degree
6,393 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x