Write a python program that will ask the user to type in a number. Then print that number followed by that many asterisks (*). | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a python program that will ask the user to type in a number. Then print that number followed by that many asterisks (*).

Enter a number: 5 5 ***** This is what I did but didn't work: num = input("Enter a number: 5") print("5 *****")

28th Mar 2020, 12:35 PM
Cameron Mason
Cameron Mason - avatar
8 Answers
+ 4
If it is your home work or if you want solution then show your attempt.. What are you tried so far...? Please read this and follow the community guidelines... Thank you.. https://www.sololearn.com/discuss/1316935/?ref=app Edit: thanks for edit. You got the answer already.
28th Mar 2020, 12:44 PM
Jayakrishna 🇮🇳
+ 2
print("*" *int(input()), end="")
28th Mar 2020, 12:42 PM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
+ 2
Cameron Mason num=int(input()) print(num,"*"*num)
28th Mar 2020, 12:51 PM
Muhammad Bilal
Muhammad Bilal - avatar
+ 1
Kindly show your attempt first than ask about any confusion related to code. Try first and than ask here. Hint: Multiplication of string by int.
28th Mar 2020, 12:42 PM
Muhammad Bilal
Muhammad Bilal - avatar
+ 1
num = input("Enter a number: 5") print("5 *****") this is what I did but didn't work
28th Mar 2020, 12:47 PM
Cameron Mason
Cameron Mason - avatar
0
num=int(input("insert you number: ")) print(num,(lambda i:"*"*num)(num))
28th Mar 2020, 4:00 PM
Lafaed
Lafaed - avatar
0
Добрый
29th Mar 2020, 2:45 PM
Dado Furs
0
num = float(input("Enter a number: ")) print(str(num)+" "+"*"*num) There you go
30th Mar 2020, 4:48 AM
randomnoobprogrammer