+ 3

Arguments and Type

def print_with_exclamation(word): print(word + 3) print_with_exclamation(2) print_with_exclamation(6) print_with_exclamation(1) Output : 5 9 4 So how can we change code to get output : 23 63 13 Could you answer this please? :)

17th Jun 2018, 10:41 PM
Gizem Güleli
Gizem Güleli - avatar
7 Respostas
+ 5
This might help: def x(word) : print(str(word)+str(3)) x(3) output : 33
17th Jun 2018, 11:13 PM
Muhammad Hasan
Muhammad Hasan - avatar
+ 4
Gizem Güleli You mean changing it into a string? you could use str(number) to change it into a string
17th Jun 2018, 11:11 PM
Muhammad Hasan
Muhammad Hasan - avatar
+ 4
Your Welcome 😉
17th Jun 2018, 11:16 PM
Muhammad Hasan
Muhammad Hasan - avatar
+ 3
It seems that you want to append '3' at the end of an inputted number? Just change it to def print_with_exclamation(word) print(10*word+3)
17th Jun 2018, 10:57 PM
Muhammad Hasan
Muhammad Hasan - avatar
+ 2
Hello there. In order to get these outputs you need to call the function with the number needed to get the sum with 3. For example if you want 23 as the result your code should be print_with_exclamation(20), so the function executes the following command 20+3 and returns 23. Think likewise for the rest of your questions. :)
17th Jun 2018, 10:51 PM
Andrew Siachos
Andrew Siachos - avatar
+ 2
Actually this is not the thing that i want 😓 let me try to ask like that ; Is there a way to run 2,6,1 like word not like integer to get that output ? By the way sorry my English and bad explanation
17th Jun 2018, 10:55 PM
Gizem Güleli
Gizem Güleli - avatar
0
Yes right 👍🏻 Thank u so much it will help
17th Jun 2018, 11:15 PM
Gizem Güleli
Gizem Güleli - avatar