How can I write two codes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I write two codes

Some proyects need two cases but I can't or don't know how to Please help Sincerely Eros

31st Mar 2021, 2:30 AM
Eros Blue Prince 💙
Eros Blue Prince 💙 - avatar
8 Answers
+ 2
You need to write a code that will work for any input, not just that one test case. You can declare x and y as input variables to take the input from the compiler , then manipulate what you get into what you need to output. x = int(input()) y = int(input())
3rd Apr 2021, 12:46 AM
Simba
Simba - avatar
+ 1
im not completely sure what you mean by two codes, but if you need to check for 2 different cases, my initial thought would be something like the code below. if case1 is true: print(“case 1 is true”) elif case2 is true: print(“case 2 is true”) lwt me know if this makes sense. also, it would be extremely helpful if you provided details of the cases.
31st Mar 2021, 3:19 AM
you are smart. you are brave.
you are smart. you are brave. - avatar
+ 1
This case you have to option first one use 'def' fun. Or Second one is use if and elif statment.
31st Mar 2021, 5:11 AM
🔰 Arit Dey 🔰
🔰 Arit Dey 🔰 - avatar
+ 1
Thx!!
3rd Apr 2021, 9:53 PM
Eros Blue Prince 💙
Eros Blue Prince 💙 - avatar
0
No I need a different answer
1st Apr 2021, 11:24 PM
Eros Blue Prince 💙
Eros Blue Prince 💙 - avatar
0
It says it is okay test case 1# or 2# but not both
1st Apr 2021, 11:25 PM
Eros Blue Prince 💙
Eros Blue Prince 💙 - avatar
0
Oki
3rd Apr 2021, 12:28 AM
Eros Blue Prince 💙
Eros Blue Prince 💙 - avatar
0
x=11 y=22 z=x+y print(z)
3rd Apr 2021, 12:28 AM
Eros Blue Prince 💙
Eros Blue Prince 💙 - avatar