I am learning python and I have to solve this problem... Please help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

I am learning python and I have to solve this problem... Please help me

You’re given a task to write the word "hi" 42 times. Boring, right? Write a program to do it for you. Create a program to output "hi" 42 times, without any separators, on the same line. https://code.sololearn.com/cApZQ1v8379s/?ref=app

18th May 2022, 12:11 PM
Nafee Riad Farah
Nafee Riad Farah - avatar
39 Answers
+ 8
Use small p in Print, not capital P print("hi"*42)
18th May 2022, 12:31 PM
Jayakrishna 🇮🇳
+ 24
It's easy‼️😀🤣 Just: print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="") print("Hi", end="")
19th May 2022, 9:28 AM
Janusz Bujak 🇵🇱 🇺🇦
Janusz Bujak 🇵🇱 🇺🇦 - avatar
+ 4
Your try? It's explained in lesson clearly... Revise it.
18th May 2022, 12:13 PM
Jayakrishna 🇮🇳
+ 4
#small thing it is: s="hi" print(s*42)
18th May 2022, 7:29 PM
Sirigiri Manohar Reddy
+ 3
I do it.. Thank you so much in deed I really appreciate
18th May 2022, 12:30 PM
Nafee Riad Farah
Nafee Riad Farah - avatar
+ 3
Janusz Bujak 🇵🇱 🇺🇦 Excellent code. 😁👍
19th May 2022, 10:03 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Андрей Зализкий Please create an own thread, mention the programming language and the task and link your code
19th May 2022, 1:10 PM
Lisa
Lisa - avatar
+ 3
Андрей Зализкий CREATE YOUR OWN THREAD PLEASE. To LINK your code: Go to Code section, click +, select the programming language, insert your code, save. Come back to YOUR OWN THREAD, click +, Insert Code, sort for My Code Bits, select your code. You need to read the task description carefully: If there are 2 example inputs, you need to write 2 input() and use them.
19th May 2022, 4:17 PM
Lisa
Lisa - avatar
+ 2
Yes i know it is print("hi" *42)
18th May 2022, 12:14 PM
Nafee Riad Farah
Nafee Riad Farah - avatar
+ 2
But they say undefined variable "print"
18th May 2022, 12:16 PM
Nafee Riad Farah
Nafee Riad Farah - avatar
+ 2
Don't write anything else but print("hi"*42). Link your complete code if you need help.
18th May 2022, 12:19 PM
Lisa
Lisa - avatar
+ 2
Damn you made me laugh at myself🤣🤣🤣
18th May 2022, 12:32 PM
Nafee Riad Farah
Nafee Riad Farah - avatar
+ 2
for i in range(42): print("Hi", i) 🤦
19th May 2022, 11:43 AM
Андрей Богданов
Андрей Богданов - avatar
+ 2
Андрей Зализкий 1) Describe the complete task 2) Do not write anything inside input()
19th May 2022, 1:51 PM
Lisa
Lisa - avatar
+ 2
Андрей Зализкий Please try below code x = input() print(x * 10) Hope I understood your task and able to help you
19th May 2022, 2:01 PM
Sam
+ 1
Re-read the lesson – you find the answer there. Pay attention to how strings can be repeated
18th May 2022, 12:14 PM
Lisa
Lisa - avatar
+ 1
Lisa thank you very much you are so kind But i dont know how to share my code to let you help me
18th May 2022, 12:23 PM
Nafee Riad Farah
Nafee Riad Farah - avatar
+ 1
A bug or you missing something.. Can you show it by saving in playground? Close app and reopen then Try again once... edit: Nafee Riad Farah This may help you, to share links 👇 https://www.sololearn.com/post/75089/?ref=app
18th May 2022, 12:23 PM
Jayakrishna 🇮🇳
+ 1
Below is the code that should work. First_counter = 0 While first_counter < 42: print(“hi”) first_counter += 1
18th May 2022, 10:06 PM
Chris
+ 1
You have to use the multiply symbol which is this * and create the string 42 and that should work btw it should look like this! print("hi"*42)
19th May 2022, 8:57 AM
Sun1