How to create a empty variable in python like int var; in C i want to create variables hour and minute of int type . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How to create a empty variable in python like int var; in C i want to create variables hour and minute of int type .

AM="AM" PM="PM" ampm=[] inp=input() inp=input("%d %d %s" %(hour,minute,ampm)) print(hour) print(ampm) if ampm[0] == AM[0]: if hour < 10: print("0"+hour) elif hour == 12: print("00:") else: print(hour) if ampm[0] == PM[0]: if hour == 12: print("12:") else: print(hour+12+":") if minute < 10: print("0"+minute) else: print(minute)

14th Jun 2020, 8:07 PM
Varun N
Varun N - avatar
3 Answers
+ 7
Why do you need empty variables? Can you give us a sample? Normally you don't need this.
14th Jun 2020, 8:12 PM
Lothar
Lothar - avatar
+ 6
I assume this is a code for code coach 'Military Time'? If not, can you tell what you are going to do with this code? We can help you to get bugs and issues fixed, but the logic has to be done by you. What you can do is to put the code in playground save it there and link it here. Then run the code. If errors occur, read the error message carefully. It will tell you what kind of error it is, and, very important, in which line the code occurs. As soon as i have the link from your code, i will give you some hints.
15th Jun 2020, 10:06 AM
Lothar
Lothar - avatar
+ 2
Lothar how can i modify above program
14th Jun 2020, 8:14 PM
Varun N
Varun N - avatar