please check my code (python) | Sololearn: Learn to code for FREE!

+11

please check my code (python)

x = input() y = input() if x > 80 print ('congratulations' + y ) print ('you did great ') i try to code this. but it didn't work. fyi, x is exam mark and y is name.

7/22/2021 3:29:44 PM

Nabil Norazizi

29 Answers

New Answer

+6

make the print statements on the same indent level Edit: A͢J it's no use! He will just copy your own question and use it against you!

+18

Nabil Norazizi There is Indentation problem in second print statement. It should be like this: x = int(input()) y = input() if x > 80 : print ('congratulations' + y ) print ('you did great ')

+5

x is a string, which can't be more or less than a number. Try rewriting the first line to: x = int(input()) # casting int to input

+5

Er, SHASHWAT MANDALI Python does not use '&&'. Just use 'and'.

+3

I suggest you to add else statement also and add some grades using elif Not compulsory but looks good like this:- please check my code (python) x = input() y = input() if x > 80: print ('Congratulations' + y ) print ('You got A Grade ') elif x < 80 && x > 60 : print ('Congratulations' + y ) print ('You got B Grade ') elif x < 60 && x > 40 : print ('Congratulations' + y ) print ('You got C Grade ') else: print ("Oops You Failed")

+2

Filip Dobeš What is Indentation?

+2

Sorry JavaScript done by mistake

+1

thx bro it worked :)

+1

Indentation in python refers to spaces and tabs that are used at the beginning of the statement

+1

Where in other programming languages the indentation in code is for readability only, the indentation in python is very important

+1

Indentation in python mainly used to know which statement belongs to which block and accordingly,the interpreter will execute the python code

+1

It's if(x>80): And its not indented properly i.e. the spaces before the print statements differ.

+1

Indentation problem and also the colon is missing in the if statement

+1

you need to convert input into integer type

0

still didn't work man :(

0

what is a sample input, and what is expected output?

0

here's the question : your student have completed an online exam and you as their teacher need to create a program to produce your own certificate. the student with mark higher than 80 will get a certificate. expected output : contratulations Adam you did great

0

So whats expected input?

0

x = 85 y = adam

0

if x > 80: # you forgot to add the colon(:) at the end of the if condition, also need to proper your indentation