+ 1
I need some help.
hi i have just written a code using the def function. it's my first time using it so please check out at my code and if you can help me https://code.sololearn.com/cExdOvdUx5UM/?ref=app
9 Antworten
+ 8
What would you like to do? If you need a user input taken and you want to react on it, you have to rearrange it.
First, define the function:
def user_input(letter):
if letter == 'A':
print("01000001")
elif letter == 'B':
print("01000010")
...
Then ask for user input:
letter = input('enter a CAPS LETTER')
and finally, call the function you defined:
user_input(letter)
+ 6
You have to stay consistent throughout the logical block and indent forward anytime you make a sub-block of any earlier block, so for example:
abc
def
ghi
jkl
mno
pqr
stu
vwxyz
+ 2
You wrote a function,but didn't call it.You remove the function def part and insert single or double quotes around alphabets.
Or use ord() to convert letter into ascii value and then to binary.
+ 2
xLeva The problem is print statement in first if block is not indented properly.check it.And also elif and else should be properly indented.
0
Kuba Siekierzyński it has an intented block error. Every time i have this problem. i put all the print commands 2 spaces after the beginning. so how is that even possible?
0
Rahul Mathews can you showcase it to me a bit please?
0
now it has a invalid syntax error