Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Beginner python in the classroom

I’m new to python and I’m trying to do my labs for class and this one keeps giving me a syntax error. Please help out if possible.

import random
name = input("Please enter your name")
print(name)
integ = int(input(name + ","  +  " please enter an integer: "))
print(integ)
integ2 = int(input(name + "," + " please enter another integer: "))
print(integ2)
divis = (integ % integ2)
print(divis)
if divis == 0:
    print(str(integ) + " is divisible by " + (str(integ2))
else:
    print(str(integ) + " is NOT divisible by " + (str(integ2))```

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Your brackets are not balanced.

import random
name = input("Please enter your name")
print(name)
integ = int(input(name + ","  +  " please enter an integer: "))
print(integ)
integ2 = int(input(name + "," + " please enter another integer: "))
print(integ2)
divis = (integ % integ2)
print(divis)
if divis == 0:
    print(str(integ) + " is divisible by " + (str(integ2)))
else:
    print(str(integ) + " is NOT divisible by " + (str(integ2)))
 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading